--- a/chat/components/src/imAccounts.js
+++ b/chat/components/src/imAccounts.js
@@ -562,17 +562,17 @@ imAccount.prototype = {
if (aPassword &&
this._connectionErrorReason == Ci.imIAccount.ERROR_MISSING_PASSWORD)
this._connectionErrorReason = Ci.imIAccount.NO_ERROR;
else if (!aPassword && this._passwordRequired)
this._connectionErrorReason = Ci.imIAccount.ERROR_MISSING_PASSWORD;
this._sendUpdateNotification();
},
_handleMasterPasswordException: function(aException) {
- if (aException.result != Components.results.NS_ERROR_ABORT)
+ if (aException.result != Cr.NS_ERROR_ABORT)
throw aException;
gUserCanceledMasterPasswordPrompt = true;
executeSoon(function () { gUserCanceledMasterPasswordPrompt = false; });
},
get autoLogin() {
let autoLogin = true;
--- a/chat/components/src/imContacts.js
+++ b/chat/components/src/imContacts.js
@@ -599,17 +599,17 @@ Contact.prototype = {
return this._buddies.length == 0 ||
this._buddies.every(b => b._empty);
},
mergeContact: function(aContact) {
// Avoid merging the contact with itself or merging into an
// already removed contact.
if (aContact.id == this.id || !(this.id in ContactsById))
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
this._ensureNotDummy();
let contact = ContactsById[aContact.id]; // remove XPConnect wrapper
// Copy all the contact-only tags first, otherwise they would be lost.
for (let tag of contact.getTags())
if (!contact._isTagInherited(tag))
this.addTag(tag);
@@ -638,17 +638,17 @@ Contact.prototype = {
this._buddies.splice(newPosition, 0, buddy);
this._updatePositions(Math.min(oldPosition, newPosition),
Math.max(oldPosition, newPosition));
buddy._notifyObservers("position-changed", String(newPosition));
this._updatePreferredBuddy(buddy);
},
adoptBuddy: function(aBuddy) {
if (aBuddy.contact.id == this.id)
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
let buddy = BuddiesById[aBuddy.id]; // remove XPConnect wrapper
buddy.contact = this;
this._updatePreferredBuddy(buddy);
},
_massRemove: false,
_removeBuddy: function(aBuddy) {
if (this._buddies.length == 1) {
@@ -708,19 +708,19 @@ Contact.prototype = {
}
statement.finalize();
},
detachBuddy: function(aBuddy) {
// Should return a new contact with the same list of tags.
let buddy = BuddiesById[aBuddy.id];
if (buddy.contact.id != this.id)
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
if (buddy.contact._buddies.length == 1)
- throw Components.results.NS_ERROR_UNEXPECTED;
+ throw Cr.NS_ERROR_UNEXPECTED;
// Save the list of tags, it may be destoyed if the buddy was the last one.
let tags = buddy.contact.getTags();
// Create a new dummy contact and use it for the detached buddy.
buddy.contact = new Contact();
buddy.contact._notifyObservers("added");
@@ -950,17 +950,17 @@ Buddy.prototype = {
get protocol() { return this._accounts[0].account.protocol; },
get userName() { return this._name; },
get normalizedName() { return this._key; },
_srvAlias: "",
_contact: null,
get contact() { return this._contact; },
set contact(aContact) /* not in imIBuddy */ {
if (aContact.id == this._contact.id)
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
this._notifyObservers("moved-out-of-contact");
this._contact._removeBuddy(this);
this._contact = aContact;
this._contact._buddies.push(this);
// Ensure all the inherited tags are in the new contact.
--- a/chat/components/src/logger.js
+++ b/chat/components/src/logger.js
@@ -214,18 +214,18 @@ LogWriter.prototype = {
},
_serialize: function cl_serialize(aString) {
// TODO cleanup once bug 102699 is fixed
let doc = getHiddenHTMLWindow().document;
let div = doc.createElementNS("http://www.w3.org/1999/xhtml", "div");
div.innerHTML = aString.replace(/\r?\n/g, "<br/>").replace(/<br>/gi, "<br/>");
const type = "text/plain";
let encoder =
- Components.classes["@mozilla.org/layout/documentEncoder;1?type=" + type]
- .createInstance(Components.interfaces.nsIDocumentEncoder);
+ Cc["@mozilla.org/layout/documentEncoder;1?type=" + type]
+ .createInstance(Ci.nsIDocumentEncoder);
encoder.init(doc, type, 0);
encoder.setContainerNode(div);
encoder.setNodeFixup({fixupNode: function(aNode, aSerializeKids) {
if (aNode.localName == "a" && aNode.hasAttribute("href")) {
let url = aNode.getAttribute("href");
let content = aNode.textContent;
if (url != content)
aNode.textContent = content + " (" + url + ")";
--- a/chat/content/browserRequest.js
+++ b/chat/content/browserRequest.js
@@ -1,15 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource:///modules/imServices.jsm");
-var wpl = Components.interfaces.nsIWebProgressListener;
+var wpl = Ci.nsIWebProgressListener;
var reporterListener = {
_isBusy: false,
get statusMeter() {
delete this.statusMeter;
return this.statusMeter = document.getElementById("statusbar-icon");
},
get securityButton() {
@@ -21,21 +21,21 @@ var reporterListener = {
return this.securityLabel = document.getElementById("security-status");
},
get securityDisplay() {
delete this.securityDisplay;
return this.securityDisplay = document.getElementById("security-display");
},
QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIWebProgressListener) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
onStateChange: function(/*in nsIWebProgress*/ aWebProgress,
/*in nsIRequest*/ aRequest,
/*in unsigned long*/ aStateFlags,
/*in nsresult*/ aStatus) {
if (aStateFlags & wpl.STATE_START &&
aStateFlags & wpl.STATE_IS_NETWORK) {
this.statusMeter.value = 0;
@@ -114,36 +114,36 @@ function cancelRequest()
{
reportUserClosed();
window.close();
}
function reportUserClosed()
{
let request = window.arguments[0];
- request.QueryInterface(Components.interfaces.prplIRequestBrowser);
+ request.QueryInterface(Ci.prplIRequestBrowser);
request.cancelled();
}
function loadRequestedUrl()
{
let request = window.arguments[0];
- request.QueryInterface(Components.interfaces.prplIRequestBrowser);
+ request.QueryInterface(Ci.prplIRequestBrowser);
document.getElementById("headerMessage").textContent = request.promptText;
let account = request.account;
document.getElementById("headerLabel").value =
account.protocol.name + " - " + account.name;
document.getElementById("headerImage").src =
account.protocol.iconBaseURI + "icon48.png";
let browser = document.getElementById("requestFrame");
browser.docShell.allowPlugins = false;
if (Services.prefs.getBoolPref("chat.browserRequest.disableJavascript"))
browser.docShell.allowJavascript = false;
browser.addProgressListener(reporterListener,
- Components.interfaces.nsIWebProgress.NOTIFY_ALL);
+ Ci.nsIWebProgress.NOTIFY_ALL);
let url = request.url;
if (url != "")
browser.setAttribute("src", url);
request.loaded(window, browser.webProgress);
}
--- a/chat/content/convbrowser.xml
+++ b/chat/content/convbrowser.xml
@@ -83,17 +83,17 @@
<property name="docShell"
onget="return this._docShell || (this._docShell = this.boxObject.docShell);"
readonly="true"/>
<property name="messageManager"
readonly="true">
<getter>
<![CDATA[
- var owner = this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner);
+ var owner = this.QueryInterface(Ci.nsIFrameLoaderOwner);
if (!owner.frameLoader) {
return null;
}
return owner.frameLoader.messageManager;
]]>
</getter>
</property>
@@ -125,18 +125,18 @@
<![CDATA[
if (!this._fastFind) {
if (!("@mozilla.org/typeaheadfind;1" in Components.classes))
return null;
if (!this.docShell)
return null;
- this._fastFind = Components.classes["@mozilla.org/typeaheadfind;1"]
- .createInstance(Components.interfaces.nsITypeAheadFind);
+ this._fastFind = Cc["@mozilla.org/typeaheadfind;1"]
+ .createInstance(Ci.nsITypeAheadFind);
this._fastFind.init(this.docShell);
}
return this._fastFind;
]]>
</getter>
</property>
<field name="_lastSearchString">null</field>
@@ -195,30 +195,30 @@
<method name="enableMagicCopy">
<body>
<![CDATA[
this.contentWindow.controllers.insertControllerAt(0, this);
this.autoCopyEnabled = Services.clipboard.supportsSelectionClipboard() &&
Services.prefs.getBoolPref("clipboard.autocopy");
if (this.autoCopyEnabled) {
this.contentWindow.getSelection()
- .QueryInterface(Components.interfaces.nsISelectionPrivate)
+ .QueryInterface(Ci.nsISelectionPrivate)
.addSelectionListener(this);
}
]]>
</body>
</method>
<method name="disableMagicCopy">
<body>
<![CDATA[
this.contentWindow.controllers.removeController(this);
if (this.autoCopyEnabled) {
this.contentWindow.getSelection()
- .QueryInterface(Components.interfaces.nsISelectionPrivate)
+ .QueryInterface(Ci.nsISelectionPrivate)
.removeSelectionListener(this);
}
]]>
</body>
</method>
<field name="autoCopyEnabled">false</field>
<field name="magicCopyPref" readonly="true">"messenger.conversations.selections.magicCopyEnabled"</field>
@@ -252,17 +252,17 @@
]]>
</body>
</method>
<method name="addProgressListener">
<parameter name="aListener"/>
<body>
<![CDATA[
- this.webProgress.addProgressListener(aListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
+ this.webProgress.addProgressListener(aListener, Ci.nsIWebProgress.NOTIFY_ALL);
]]>
</body>
</method>
<method name="removeProgressListener">
<parameter name="aListener"/>
<body>
<![CDATA[
@@ -510,18 +510,18 @@
// Close any open bubble.
this._lastMessage = null;
}
// Suppress this message unless it was an error message.
if (!aMsg.error)
return;
}
- let cs = Components.classes["@mozilla.org/txttohtmlconv;1"]
- .getService(Ci.mozITXTToHTMLConv);
+ let cs = Cc["@mozilla.org/txttohtmlconv;1"]
+ .getService(Ci.mozITXTToHTMLConv);
/*
* kStructPhrase creates tags for plaintext-markup like *bold*,
* /italics/, etc. We always use this; the content filter will
* filter it out if the user does not want styling.
*/
let csFlags = cs.kStructPhrase;
// Automatically find and link freetext URLs
if (!aMsg.noLinkification)
@@ -863,19 +863,19 @@
<method name="doCommand">
<parameter name="aCommand"/>
<body>
<![CDATA[
let selection = this.contentWindow.getSelection();
if (selection.isCollapsed)
return;
- Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Ci.nsIClipboardHelper)
- .copyString(serializeSelection(selection));
+ Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper)
+ .copyString(serializeSelection(selection));
]]>
</body>
</method>
<method name="onEvent">
<parameter name="aCommand"/>
</method>
@@ -886,19 +886,19 @@
<parameter name="aReason"/>
<body>
<![CDATA[
if (!(aReason & Ci.nsISelectionListener.MOUSEUP_REASON ||
aReason & Ci.nsISelectionListener.SELECTALL_REASON ||
aReason & Ci.nsISelectionListener.KEYPRESS_REASON))
return; // we are still dragging, don't bother with the selection
- Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Ci.nsIClipboardHelper)
- .copyStringToClipboard(serializeSelection(aSelection),
+ Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper)
+ .copyStringToClipboard(serializeSelection(aSelection),
Ci.nsIClipboard.kSelectionClipboard);
]]>
</body>
</method>
<method name="_exposeMethodsToContent">
<body>
<![CDATA[
@@ -913,24 +913,24 @@
<!-- nsIWebProgressListener implementation -->
<method name="onStateChange">
<parameter name="aProgress"/>
<parameter name="aRequest"/>
<parameter name="aStateFlags"/>
<parameter name="aStatus"/>
<body>
<![CDATA[
- const WPL = Components.interfaces.nsIWebProgressListener;
+ const WPL = Ci.nsIWebProgressListener;
if ((aStateFlags & WPL.STATE_IS_DOCUMENT) &&
(aStateFlags & WPL.STATE_STOP)) {
if (!this._loadState) {
try {
initHTMLDocument(this._conv, this.theme, this.contentDocument);
} catch(e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
this._loadState = 1;
this._exposeMethodsToContent();
// A common use case is to click somewhere in the conversation and
// start typing a command (often /me). If quick find is enabled, it
// will pick up the "/" keypress and open the findbar. See bug 1161930.
@@ -1240,17 +1240,17 @@
"_firstNonContextElt"];
var ourFieldValues = {};
var otherFieldValues = {};
for (var field of fieldsToSwap) {
ourFieldValues[field] = this[field];
otherFieldValues[field] = aOtherBrowser[field];
}
- this.QueryInterface(Components.interfaces.nsIFrameLoaderOwner)
+ this.QueryInterface(Ci.nsIFrameLoaderOwner)
.swapFrameLoaders(aOtherBrowser);
for (var field of fieldsToSwap) {
this[field] = otherFieldValues[field];
aOtherBrowser[field] = ourFieldValues[field];
}
this._exposeMethodsToContent();
@@ -1290,19 +1290,19 @@
// allowed by our IM filters and exposed.
if (!uri.schemeIs("http") && !uri.schemeIs("https"))
return;
event.preventDefault();
event.stopPropagation();
// loadURI can throw if the default browser is misconfigured.
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
- .loadURI(uri);
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(uri);
}
]]>
</handler>
<handler event="keypress" modifiers="shift" keycode="VK_PAGE_UP"
action="this.docShell.QueryInterface(Components.interfaces.nsITextScroll).scrollByPages(-1);"/>
<handler event="keypress" modifiers="shift" keycode="VK_PAGE_DOWN"
--- a/chat/modules/imContentSink.jsm
+++ b/chat/modules/imContentSink.jsm
@@ -250,18 +250,18 @@ function cleanupNode(aNode, aRules, aTex
for (let i = 0; i < aNode.childNodes.length; ++i) {
let node = aNode.childNodes[i];
if (node.nodeType == node.ELEMENT_NODE &&
node.namespaceURI == "http://www.w3.org/1999/xhtml") {
// check if node allowed
let nodeName = node.localName;
if (!(nodeName in aRules.tags)) {
if (nodeName in kForbiddenTags) {
- Components.utils.reportError("removing a " + nodeName +
- " tag from a message before display");
+ Cu.reportError("removing a " + nodeName +
+ " tag from a message before display");
}
else {
// this node is not allowed, replace it with its children
while (node.hasChildNodes())
aNode.insertBefore(node.removeChild(node.firstChild), node);
}
aNode.removeChild(node);
// We want to process again the node at the index i which is
@@ -335,17 +335,17 @@ function cleanupNode(aNode, aRules, aTex
let textNodeCount = 1;
for (let modifier of aTextModifiers)
for (let n = 0; n < textNodeCount; ++n) {
let textNode = aNode.childNodes[i + n];
// If we are processing nodes created by one of the previous
// text modifier function, some of the nodes are likely not
// text node, skip them.
- if (!(textNode instanceof Components.interfaces.nsIDOMText))
+ if (!(textNode instanceof Ci.nsIDOMText))
continue;
let result = modifier(textNode);
textNodeCount += result;
n += result;
}
// newly created nodes should not be filtered, be sure we skip them!
@@ -354,16 +354,16 @@ function cleanupNode(aNode, aRules, aTex
}
}
function cleanupImMarkup(aText, aRuleset, aTextModifiers = [])
{
if (!gGlobalRuleset)
initGlobalRuleset();
- let parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
- .createInstance(Components.interfaces.nsIDOMParser);
+ let parser = Cc["@mozilla.org/xmlextras/domparser;1"]
+ .createInstance(Ci.nsIDOMParser);
// Wrap the text to be parsed in a <span> to avoid losing leading whitespace.
let doc = parser.parseFromString("<span>" + aText + "</span>", "text/html");
let span = doc.querySelector("span");
cleanupNode(span, aRuleset || gGlobalRuleset, aTextModifiers);
return span.innerHTML;
}
--- a/chat/modules/imSmileys.jsm
+++ b/chat/modules/imSmileys.jsm
@@ -44,19 +44,19 @@ var gPrefObserver = {
throw "bad notification";
gTheme = getTheme();
}
};
function getSmileRealURI(aSmile)
{
- aSmile = Components.classes["@mozilla.org/intl/texttosuburi;1"]
- .getService(Components.interfaces.nsITextToSubURI)
- .unEscapeURIForUI("UTF-8", aSmile);
+ aSmile = Cc["@mozilla.org/intl/texttosuburi;1"]
+ .getService(Ci.nsITextToSubURI)
+ .unEscapeURIForUI("UTF-8", aSmile);
if (aSmile in gTheme.iconsHash)
return gTheme.baseUri + gTheme.iconsHash[aSmile].filename;
throw "Invalid smile!";
}
function getSmileyList(aThemeName)
{
@@ -89,48 +89,48 @@ function getTheme(aName)
if (name == "default")
theme.baseUri = "chrome://instantbird-emoticons/skin/";
else
theme.baseUri = "chrome://" + theme.name + "/skin/";
try {
let channel = Services.io.newChannel2(theme.baseUri + kThemeFile, null, null, null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_IMAGE);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_IMAGE);
let stream = channel.open();
let bytes = NetUtil.readInputStream(stream, stream.available());
theme.json = JSON.parse(gTextDecoder.decode(bytes));
stream.close();
theme.iconsHash = {};
for (let smiley of theme.json.smileys) {
for (let textCode of smiley.textCodes)
theme.iconsHash[textCode] = smiley;
}
} catch(e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
return theme;
}
function getRegexp()
{
if (gTheme.regExp) {
gTheme.regExp.lastIndex = 0;
return gTheme.regExp;
}
// return null if smileys are disabled
if (!gTheme.iconsHash)
return null;
if ("" in gTheme.iconsHash) {
- Components.utils.reportError("Emoticon " +
- gTheme.iconsHash[""].filename +
- " matches the empty string!");
+ Cu.reportError("Emoticon " +
+ gTheme.iconsHash[""].filename +
+ " matches the empty string!");
delete gTheme.iconsHash[""];
}
let emoticonList = [];
for (let emoticon in gTheme.iconsHash)
emoticonList.push(emoticon);
let exp = /[[\]{}()*+?.\\^$|]/g;
@@ -205,17 +205,17 @@ function smileTextNode(aNode)
function smileNode(aNode)
{
for (let i = 0; i < aNode.childNodes.length; ++i) {
let node = aNode.childNodes[i];
if (node.nodeType == node.ELEMENT_NODE &&
node.namespaceURI == "http://www.w3.org/1999/xhtml") {
// we are on a tag, recurse to process its children
smileNode(node);
- } else if (node instanceof Components.interfaces.nsIDOMText) {
+ } else if (node instanceof Ci.nsIDOMText) {
// we are on a text node, process it
smileTextNode(node);
}
}
}
function smileImMarkup(aDocument, aText)
{
--- a/chat/modules/imThemes.jsm
+++ b/chat/modules/imThemes.jsm
@@ -48,24 +48,24 @@ function getChromeFile(aURI)
{
try {
let channel = Services.io.newChannel2(aURI, null, null, null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
Ci.nsIContentPolicy.TYPE_OTHER);
let stream = channel.open();
- let sstream = Components.classes["@mozilla.org/scriptableinputstream;1"]
- .createInstance(Ci.nsIScriptableInputStream);
+ let sstream = Cc["@mozilla.org/scriptableinputstream;1"]
+ .createInstance(Ci.nsIScriptableInputStream);
sstream.init(stream);
let text = sstream.read(sstream.available());
sstream.close();
return text;
} catch (e) {
- if (e.result != Components.results.NS_ERROR_FILE_NOT_FOUND)
+ if (e.result != Cr.NS_ERROR_FILE_NOT_FOUND)
dump("Getting " + aURI + ": " + e + "\n");
return null;
}
}
function HTMLTheme(aBaseURI)
{
let files = {
@@ -157,29 +157,29 @@ function getInfoPlistContent(aBaseURI)
{
try {
let channel = Services.io.newChannel2(aBaseURI + "Info.plist", null, null, null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
Ci.nsIContentPolicy.TYPE_OTHER);
let stream = channel.open();
- let parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
- .createInstance(Ci.nsIDOMParser);
+ let parser = Cc["@mozilla.org/xmlextras/domparser;1"]
+ .createInstance(Ci.nsIDOMParser);
let doc = parser.parseFromStream(stream, null, stream.available(), "text/xml");
if (doc.documentElement.localName != "plist")
throw "Invalid Info.plist file";
let node = doc.documentElement.firstChild;
while (node && !(node instanceof Ci.nsIDOMElement))
node = node.nextSibling;
if (!node || node.localName != "dict")
throw "Empty or invalid Info.plist file";
return plistToJSON(node);
} catch(e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
return null;
}
}
function getChromeBaseURI(aThemeName)
{
if (DEFAULT_THEMES.includes(aThemeName))
return "chrome://messenger-messagestyles/skin/" + aThemeName + "/";
@@ -212,50 +212,50 @@ function getCurrentTheme()
if (gCurrentTheme && gCurrentTheme.name == name &&
gCurrentTheme.variant == variant)
return gCurrentTheme;
try {
gCurrentTheme = getThemeByName(name);
gCurrentTheme.variant = variant;
} catch(e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
gCurrentTheme = getThemeByName(DEFAULT_THEME);
gCurrentTheme.variant = "default";
}
return gCurrentTheme;
}
function getDirectoryEntries(aDir)
{
let ios = Services.io;
let uri = ios.newURI(aDir);
- let cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
- .getService(Ci.nsIXULChromeRegistry);
+ let cr = Cc["@mozilla.org/chrome/chrome-registry;1"]
+ .getService(Ci.nsIXULChromeRegistry);
while (uri.scheme == "chrome")
uri = cr.convertChromeURL(uri);
// remove any trailing file name added by convertChromeURL
let spec = uri.spec.replace(/[^\/]+$/, "");
uri = ios.newURI(spec);
let results = [];
if (uri.scheme == "jar") {
uri.QueryInterface(Ci.nsIJARURI);
let strEntry = uri.JAREntry;
if (!strEntry)
return [];
- let zr = Components.classes["@mozilla.org/libjar/zip-reader;1"]
- .createInstance(Ci.nsIZipReader);
+ let zr = Cc["@mozilla.org/libjar/zip-reader;1"]
+ .createInstance(Ci.nsIZipReader);
let jarFile = uri.JARFile;
if (jarFile instanceof Ci.nsIJARURI) {
- let innerZr = Components.classes["@mozilla.org/libjar/zip-reader;1"]
- .createInstance(Ci.nsIZipReader);
+ let innerZr = Cc["@mozilla.org/libjar/zip-reader;1"]
+ .createInstance(Ci.nsIZipReader);
innerZr.open(jarFile.JARFile.QueryInterface(Ci.nsIFileURL).file);
zr.openInner(innerZr, jarFile.JAREntry);
}
else
zr.open(jarFile.QueryInterface(Ci.nsIFileURL).file);
if (!zr.hasEntry(strEntry) || !zr.getEntry(strEntry).isDirectory) {
zr.close();
@@ -461,18 +461,18 @@ function replaceKeywordsInHTML(aHTML, aR
let previousIndex = 0;
let result = "";
let match;
while ((match = kReplacementRegExp.exec(aHTML))) {
let content = "";
if (match[1] in aReplacements)
content = aReplacements[match[1]](aReplacementArg, match[3]);
else
- Components.utils.reportError("Unknown replacement string %" +
- match[1] + "% in message styles.");
+ Cu.reportError("Unknown replacement string %" +
+ match[1] + "% in message styles.");
result += aHTML.substring(previousIndex, match.index) + content;
previousIndex = kReplacementRegExp.lastIndex;
}
return result + aHTML.slice(previousIndex);
}
function isNextMessage(aTheme, aMsg, aPreviousMsg)
@@ -652,18 +652,18 @@ function getEllipsis()
function _serializeDOMObject(aDocument, aInitFunction)
{
// This shouldn't really be a constant, as we want to support
// text/html too in the future.
const type = "text/plain";
let encoder =
- Components.classes["@mozilla.org/layout/documentEncoder;1?type=" + type]
- .createInstance(Ci.nsIDocumentEncoder);
+ Cc["@mozilla.org/layout/documentEncoder;1?type=" + type]
+ .createInstance(Ci.nsIDocumentEncoder);
encoder.init(aDocument, type, Ci.nsIDocumentEncoder.OutputPreformatted);
aInitFunction(encoder);
let result = encoder.encodeToString();
return result;
}
function serializeRange(aRange)
{
--- a/chat/protocols/jsTest/jsTestProtocol.js
+++ b/chat/protocols/jsTest/jsTestProtocol.js
@@ -45,17 +45,17 @@ Account.prototype = {
this.reportConnected();
setTimeout((function() {
this._conv = new Conversation(this);
this._conv.writeMessage("jstest", "You are now talking to /dev/null", {system: true});
}).bind(this), 0);
},
_conv: null,
disconnect: function(aSilent) {
- this.reportDisconnecting(Components.interfaces.prplIAccount.NO_ERROR, "");
+ this.reportDisconnecting(Ci.prplIAccount.NO_ERROR, "");
if (!aSilent)
this._conv.writeMessage("jstest", "You have disconnected.", {system: true});
if (this._conv) {
this._conv._setDisconnected();
delete this._conv;
}
this.reportDisconnected();
},
--- a/common/bindings/preferences.xml
+++ b/common/bindings/preferences.xml
@@ -70,17 +70,17 @@
<body>
<![CDATA[
// Value changed, synthesize an event
try {
var event = document.createEvent("Events");
event.initEvent("change", true, true);
aPreference.dispatchEvent(event);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
]]>
</body>
</method>
<field name="service">
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
@@ -144,18 +144,18 @@
return;
this.preferences.rootBranchInternal
.addObserver(this.name, this.preferences);
// In non-instant apply mode, we must try and use the last saved state
// from any previous opens of a child dialog instead of the value from
// preferences, to pick up any edits a user may have made.
- var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
- .getService(Components.interfaces.nsIScriptSecurityManager);
+ var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
+ .getService(Ci.nsIScriptSecurityManager);
if (this.preferences.type == "child" &&
!this.instantApply && window.opener &&
secMan.isSystemPrincipal(window.opener.document.nodePrincipal)) {
var pdoc = window.opener.document;
// Try to find a preference element for the same preference.
var preference = null;
var parentPreferences = pdoc.getElementsByTagName("preferences");
@@ -335,18 +335,18 @@
</getter>
</property>
<field name="batching">false</field>
<method name="_reportUnknownType">
<body>
<![CDATA[
- var consoleService = Components.classes["@mozilla.org/consoleservice;1"]
- .getService(Components.interfaces.nsIConsoleService);
+ var consoleService = Cc["@mozilla.org/consoleservice;1"]
+ .getService(Ci.nsIConsoleService);
var msg = "<preference> with id='" + this.id + "' and name='" +
this.name + "' has unknown type '" + this.type + "'.";
consoleService.logStringMessage(msg);
]]>
</body>
</method>
<property name="valueFromPreferences">
@@ -357,29 +357,29 @@
switch (this.type) {
case "int":
return this._branch.getIntPref(this.name);
case "bool":
var val = this._branch.getBoolPref(this.name);
return this.inverted ? !val : val;
case "wstring":
return this._branch
- .getComplexValue(this.name, Components.interfaces.nsIPrefLocalizedString)
+ .getComplexValue(this.name, Ci.nsIPrefLocalizedString)
.data;
case "string":
case "unichar":
return this._branch.getStringPref(this.name);
case "fontname":
var family = this._branch.getStringPref(this.name);
- var fontEnumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
- .createInstance(Components.interfaces.nsIFontEnumerator);
+ var fontEnumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
+ .createInstance(Ci.nsIFontEnumerator);
return fontEnumerator.getStandardFamilyName(family);
case "file":
var f = this._branch
- .getComplexValue(this.name, Components.interfaces.nsIFile);
+ .getComplexValue(this.name, Ci.nsIFile);
return f;
default:
this._reportUnknownType();
}
} catch (e) { }
return null;
]]>
</getter>
@@ -399,39 +399,39 @@
switch (this.type) {
case "int":
this.preferences.rootBranch.setIntPref(this.name, val);
break;
case "bool":
this.preferences.rootBranch.setBoolPref(this.name, this.inverted ? !val : val);
break;
case "wstring":
- var pls = Components.classes["@mozilla.org/pref-localizedstring;1"]
- .createInstance(Components.interfaces.nsIPrefLocalizedString);
+ var pls = Cc["@mozilla.org/pref-localizedstring;1"]
+ .createInstance(Ci.nsIPrefLocalizedString);
pls.data = val;
this.preferences.rootBranch
- .setComplexValue(this.name, Components.interfaces.nsIPrefLocalizedString, pls);
+ .setComplexValue(this.name, Ci.nsIPrefLocalizedString, pls);
break;
case "string":
case "unichar":
case "fontname":
this.preferences.rootBranch.setStringPref(this.name, val);
break;
case "file":
var lf;
if (typeof(val) == "string") {
- lf = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ lf = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
lf.persistentDescriptor = val;
if (!lf.exists())
lf.initWithPath(val);
} else
- lf = val.QueryInterface(Components.interfaces.nsIFile);
+ lf = val.QueryInterface(Ci.nsIFile);
this.preferences.rootBranch
- .setComplexValue(this.name, Components.interfaces.nsIFile, lf);
+ .setComplexValue(this.name, Ci.nsIFile, lf);
break;
default:
this._reportUnknownType();
}
if (!this.batching)
this.preferences.service.savePrefFile(null);
return val;
]]>
@@ -453,17 +453,17 @@
// Value changed, synthesize an event
try {
var event = document.createEvent("Events");
event.initEvent("syncfrompreference", true, true);
var f = new Function("event",
aElement.getAttribute("onsyncfrompreference"));
rv = f.call(aElement, event);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
var val = rv;
if (val === undefined)
val = this.instantApply ? this.valueFromPreferences : this.value;
// if the preference is marked for reset, show default value in UI
if (val === undefined)
val = this.defaultValue;
@@ -508,17 +508,17 @@
var event = document.createEvent("Events");
event.initEvent("synctopreference", true, true);
var f = new Function("event",
aElement.getAttribute("onsynctopreference"));
var rv = f.call(aElement, event);
if (rv !== undefined)
return rv;
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
/**
* Read the value of an attribute from an element, assuming the
* attribute is a property on the element's node API. If the property
* is not present in the API, then assume its value is contained in
* an attribute, as is the case before a binding has been attached.
@@ -635,18 +635,18 @@
<children/>
</xul:hbox>
</content>
<implementation implements="nsITimerCallback">
<constructor>
<![CDATA[
if (this.type != "child") {
if (!this._instantApplyInitialized) {
- let psvc = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+ let psvc = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch);
this.instantApply = psvc.getBoolPref("browser.preferences.instantApply");
}
if (this.instantApply) {
var docElt = document.documentElement;
var acceptButton = docElt.getButton("accept");
acceptButton.hidden = true;
var cancelButton = docElt.getButton("cancel");
if (/Mac/.test(navigator.platform)) {
@@ -809,17 +809,17 @@
if (aTarget.hasAttribute("on" + aEventName)) {
var fn = new Function("event", aTarget.getAttribute("on" + aEventName));
var rv = fn.call(aTarget, event);
if (!rv)
cancel = true;
}
return !cancel;
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
return false;
]]>
</body>
</method>
<field name="_initialized">false</field>
<method name="_selectPane">
@@ -894,18 +894,18 @@
}
]]>
</body>
</method>
<property name="_shouldAnimate">
<getter>
<![CDATA[
- var psvc = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+ var psvc = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch);
return psvc.getBoolPref("browser.preferences.animateFadeIn",
/Mac/.test(navigator.platform));
]]>
</getter>
</property>
<method name="animate">
<parameter name="aOldPane"/>
@@ -972,39 +972,39 @@
</body>
</method>
<method name="_setUpAnimationTimer">
<parameter name="aStartHeight"/>
<body>
<![CDATA[
if (!this._animateTimer)
- this._animateTimer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ this._animateTimer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
else
this._animateTimer.cancel();
this._currentHeight = aStartHeight;
this._animateTimer.initWithCallback(this, this._animateDelay,
- Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
+ Ci.nsITimer.TYPE_REPEATING_SLACK);
]]>
</body>
</method>
<method name="_setUpFadeTimer">
<body>
<![CDATA[
if (!this._fadeTimer)
- this._fadeTimer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ this._fadeTimer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
else
this._fadeTimer.cancel();
this._fadeTimer.initWithCallback(this, this._fadeDelay,
- Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
+ Ci.nsITimer.TYPE_REPEATING_SLACK);
]]>
</body>
</method>
<field name="_animateTimer">null</field>
<field name="_fadeTimer">null</field>
<field name="_animateDelay">15</field>
<field name="_animateIncrement">40</field>
@@ -1037,18 +1037,18 @@
<method name="openWindow">
<parameter name="aWindowType"/>
<parameter name="aURL"/>
<parameter name="aFeatures"/>
<parameter name="aParams"/>
<body>
<![CDATA[
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
+ var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator);
var win = aWindowType ? wm.getMostRecentWindow(aWindowType) : null;
if (win) {
if ("initWithParams" in win)
win.initWithParams(aParams);
win.focus();
} else {
var features = "resizable,dialog=no,centerscreen" + (aFeatures != "" ? ("," + aFeatures) : "");
var parentWindow = (this.instantApply || !window.opener || window.opener.closed) ? window : window.opener;
@@ -1061,18 +1061,18 @@
</implementation>
<handlers>
<handler event="dialogaccept">
<![CDATA[
if (!this._fireEvent("beforeaccept", this)) {
return false;
}
- var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
- .getService(Components.interfaces.nsIScriptSecurityManager);
+ var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
+ .getService(Ci.nsIScriptSecurityManager);
if (this.type == "child" && window.opener &&
secMan.isSystemPrincipal(window.opener.document.nodePrincipal)) {
var pdocEl = window.opener.document.documentElement;
if (pdocEl.instantApply) {
let panes = this.preferencePanes;
for (let i = 0; i < panes.length; ++i)
panes[i].writePreferences(true);
} else {
@@ -1118,18 +1118,18 @@
}
}
}
} else {
let panes = this.preferencePanes;
for (var i = 0; i < panes.length; ++i)
panes[i].writePreferences(false);
- let psvc = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefService);
+ let psvc = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefService);
psvc.savePrefFile(null);
}
return true;
]]>
</handler>
<handler event="command">
if (event.originalTarget.hasAttribute("pane")) {
@@ -1188,18 +1188,18 @@
var preferences = this.preferences;
for (var i = 0; i < preferences.length; ++i) {
var preference = preferences[i];
preference.batching = true;
preference.valueFromPreferences = preference.value;
preference.batching = false;
}
if (aFlushToDisk) {
- var psvc = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefService);
+ var psvc = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefService);
psvc.savePrefFile(null);
}
]]>
</body>
</method>
<property name="src"
onget="return this.getAttribute('src');"
--- a/editor/ui/composer/content/ComposerCommands.js
+++ b/editor/ui/composer/content/ComposerCommands.js
@@ -115,24 +115,24 @@ function SetupComposerWindowCommands()
var windowControllers = window.controllers;
if (!windowControllers) return;
var commandTable;
var composerController;
var editorController;
try {
- composerController = Components.classes["@mozilla.org/embedcomp/base-command-controller;1"].createInstance();
-
- editorController = composerController.QueryInterface(Components.interfaces.nsIControllerContext);
+ composerController = Cc["@mozilla.org/embedcomp/base-command-controller;1"].createInstance();
+
+ editorController = composerController.QueryInterface(Ci.nsIControllerContext);
editorController.init(null); // init it without passing in a command table
// Get the nsIControllerCommandTable interface we need to register commands
- var interfaceRequestor = composerController.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
- commandTable = interfaceRequestor.getInterface(Components.interfaces.nsIControllerCommandTable);
+ var interfaceRequestor = composerController.QueryInterface(Ci.nsIInterfaceRequestor);
+ commandTable = interfaceRequestor.getInterface(Ci.nsIControllerCommandTable);
}
catch (e)
{
dump("Failed to create composerController\n");
return;
}
@@ -187,42 +187,42 @@ function GetComposerCommandTable()
{
try {
controller = window.content.controllers.getControllerById(gComposerJSCommandControllerID);
} catch (e) {}
}
if (!controller)
{
//create it
- controller = Components.classes["@mozilla.org/embedcomp/base-command-controller;1"].createInstance();
-
- var editorController = controller.QueryInterface(Components.interfaces.nsIControllerContext);
+ controller = Cc["@mozilla.org/embedcomp/base-command-controller;1"].createInstance();
+
+ var editorController = controller.QueryInterface(Ci.nsIControllerContext);
editorController.init(null);
editorController.setCommandContext(GetCurrentEditorElement());
window.content.controllers.insertControllerAt(0, controller);
// Store the controller ID so we can be sure to get the right one later
gComposerJSCommandControllerID = window.content.controllers.getControllerId(controller);
}
if (controller)
{
- var interfaceRequestor = controller.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
- return interfaceRequestor.getInterface(Components.interfaces.nsIControllerCommandTable);
+ var interfaceRequestor = controller.QueryInterface(Ci.nsIInterfaceRequestor);
+ return interfaceRequestor.getInterface(Ci.nsIControllerCommandTable);
}
return null;
}
//-----------------------------------------------------------------------------------
function goUpdateCommandState(command)
{
try
{
var controller = top.document.commandDispatcher.getControllerForCommand(command);
- if (!(controller instanceof Components.interfaces.nsICommandController))
+ if (!(controller instanceof Ci.nsICommandController))
return;
var params = newCommandParams();
if (!params) return;
controller.getCommandStateWithParams(command, params);
switch (command)
@@ -297,17 +297,17 @@ function goUpdateComposerMenuItems(comma
//-----------------------------------------------------------------------------------
function goDoCommandParams(command, params)
{
try
{
var controller = top.document.commandDispatcher.getControllerForCommand(command);
if (controller && controller.isCommandEnabled(command))
{
- if (controller instanceof Components.interfaces.nsICommandController)
+ if (controller instanceof Ci.nsICommandController)
{
controller.doCommandWithParams(command, params);
// the following two lines should be removed when we implement observers
if (params)
controller.getCommandStateWithParams(command, params);
}
else
@@ -369,17 +369,17 @@ function pokeMultiStateUI(uiID, cmdParam
return;
var isMixed = cmdParams.getBooleanValue("state_mixed");
var desiredAttrib;
if (isMixed)
desiredAttrib = "mixed";
else {
var valuetype = cmdParams.getValueType("state_attribute");
- if (valuetype == Components.interfaces.nsICommandParams.eStringType) {
+ if (valuetype == Ci.nsICommandParams.eStringType) {
desiredAttrib = cmdParams.getCStringValue("state_attribute");
// Decode UTF-8, for example for font names in Japanese.
desiredAttrib = new TextDecoder("UTF-8").decode(stringToTypedArray(desiredAttrib));
} else {
desiredAttrib = cmdParams.getStringValue("state_attribute");
}
}
@@ -467,17 +467,17 @@ var nsOpenCommand =
getCommandStateParams: function(aCommand, aParams, aRefCon) {},
doCommandParams: function(aCommand, aParams, aRefCon) {},
doCommand: function(aCommand)
{
var fileType = IsHTMLEditor() ? "html" : "text";
var title = GetString(IsHTMLEditor() ? "OpenHTMLFile" : "OpenTextFile");
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, title, nsIFilePicker.modeOpen);
SetFilePickerDirectory(fp, fileType);
// Direct user to prefer HTML files and/or text files depending on whether
// loading into Composer or Text editor, so we call separately to control
// the order of the filter list.
if (fileType == "html")
@@ -722,18 +722,18 @@ var nsPublishAsCommand =
// ------- output utilites ----- //
// returns a fileExtension string
function GetExtensionBasedOnMimeType(aMIMEType)
{
try {
var mimeService = null;
- mimeService = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService);
+ mimeService = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService);
var fileExtension = mimeService.getPrimaryExtension(aMIMEType, null);
// the MIME service likes to give back ".htm" for text/html files,
// so do a special-case fix here.
if (fileExtension == "htm")
fileExtension = "html";
@@ -750,17 +750,17 @@ function GetSuggestedFileName(aDocumentU
extension = "." + extension;
// check for existing file name we can use
if (aDocumentURLString && !IsUrlAboutBlank(aDocumentURLString))
{
try {
let docURI = Services.io.newURI(aDocumentURLString,
GetCurrentEditor().documentCharacterSet);
- docURI = docURI.QueryInterface(Components.interfaces.nsIURL);
+ docURI = docURI.QueryInterface(Ci.nsIURL);
// grab the file name
let url = validateFileName(decodeURIComponent(docURI.fileBaseName));
if (url)
return url + extension;
} catch(e) {}
}
@@ -778,17 +778,17 @@ function PromptForSaveLocation(aDoSaveAs
{
var dialogResult = {};
dialogResult.filepickerClick = nsIFilePicker.returnCancel;
dialogResult.resultingURI = "";
dialogResult.resultingLocalFile = null;
var fp = null;
try {
- fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
} catch (e) {}
if (!fp) return dialogResult;
// determine prompt string based on type of saving we'll do
var promptString;
if (aDoSaveAsText || aEditorType == "text")
promptString = GetString("SaveTextAs");
else
@@ -887,41 +887,41 @@ var gPersistObj;
// we need to update the uri before notifying listeners
// if (doUpdateURI)
// SetDocumentURI(docURI);
// UpdateWindowTitle();
// if (!aSaveCopy)
// editor.resetModificationCount();
// this should cause notification to listeners that document has changed
-const webPersist = Components.interfaces.nsIWebBrowserPersist;
+const webPersist = Ci.nsIWebBrowserPersist;
function OutputFileWithPersistAPI(editorDoc, aDestinationLocation, aRelatedFilesParentDir, aMimeType)
{
gPersistObj = null;
var editor = GetCurrentEditor();
try {
editor.forceCompositionEnd();
} catch (e) {}
var isLocalFile = false;
try {
- var tmp1 = aDestinationLocation.QueryInterface(Components.interfaces.nsIFile);
+ var tmp1 = aDestinationLocation.QueryInterface(Ci.nsIFile);
isLocalFile = true;
}
catch (e) {
try {
- var tmp = aDestinationLocation.QueryInterface(Components.interfaces.nsIURI);
+ var tmp = aDestinationLocation.QueryInterface(Ci.nsIURI);
isLocalFile = tmp.schemeIs("file");
}
catch (e) {}
}
try {
// we should supply a parent directory if/when we turn on functionality to save related documents
- var persistObj = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(webPersist);
+ var persistObj = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(webPersist);
persistObj.progressListener = gEditorOutputProgressListener;
var wrapColumn = GetWrapColumn();
var outputFlags = GetOutputFlags(aMimeType, wrapColumn);
// for 4.x parity as well as improving readability of file locally on server
// this will always send crlf for upload (http/ftp)
if (!isLocalFile) // if we aren't saving locally then send both cr and lf
@@ -986,34 +986,34 @@ function GetOutputFlags(aMimeType, aWrap
if (aWrapColumn > 0)
outputFlags |= webPersist.ENCODE_FLAGS_WRAP;
return outputFlags;
}
// returns number of column where to wrap
-const nsIWebBrowserPersist = Components.interfaces.nsIWebBrowserPersist;
+const nsIWebBrowserPersist = Ci.nsIWebBrowserPersist;
function GetWrapColumn()
{
try {
return GetCurrentEditor().wrapWidth;
} catch (e) {}
return 0;
}
const gShowDebugOutputStateChange = false;
const gShowDebugOutputProgress = false;
const gShowDebugOutputStatusChange = false;
const gShowDebugOutputLocationChange = false;
const gShowDebugOutputSecurityChange = false;
-const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
-const nsIChannel = Components.interfaces.nsIChannel;
+const nsIWebProgressListener = Ci.nsIWebProgressListener;
+const nsIChannel = Ci.nsIChannel;
const kErrorBindingAborted = 2152398850;
const kErrorBindingRedirected = 2152398851;
const kFileNotFound = 2152857618;
var gEditorOutputProgressListener =
{
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
@@ -1067,17 +1067,17 @@ var gEditorOutputProgressListener =
}
// Detect end of file upload of any file:
if (aStateFlags & nsIWebProgressListener.STATE_STOP)
{
// ignore aStatus == kErrorBindingAborted; check http response for possible errors
try {
// check http channel for response: 200 range is ok; other ranges are not
- var httpChannel = aRequest.QueryInterface(Components.interfaces.nsIHttpChannel);
+ var httpChannel = aRequest.QueryInterface(Ci.nsIHttpChannel);
var httpResponse = httpChannel.responseStatus;
if (httpResponse < 200 || httpResponse >= 300)
aStatus = httpResponse; // not a real error but enough to pass check below
else if (aStatus == kErrorBindingAborted)
aStatus = 0;
if (gShowDebugOutputStateChange)
dump("http response is: "+httpResponse+"\n");
@@ -1292,23 +1292,23 @@ var gEditorOutputProgressListener =
var channel = aRequest.QueryInterface(nsIChannel);
dump("***** onSecurityChange request: " + channel.URI.spec + "\n");
} catch (e) {}
}
},
QueryInterface : function(aIID)
{
- if (aIID.equals(Components.interfaces.nsIWebProgressListener)
- || aIID.equals(Components.interfaces.nsISupports)
- || aIID.equals(Components.interfaces.nsISupportsWeakReference)
- || aIID.equals(Components.interfaces.nsIPrompt)
- || aIID.equals(Components.interfaces.nsIAuthPrompt))
+ if (aIID.equals(Ci.nsIWebProgressListener)
+ || aIID.equals(Ci.nsISupports)
+ || aIID.equals(Ci.nsISupportsWeakReference)
+ || aIID.equals(Ci.nsIPrompt)
+ || aIID.equals(Ci.nsIAuthPrompt))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
// nsIPrompt
alert : function(dlgTitle, text)
{
Services.prompt.alert(gProgressDialog ? gProgressDialog : window, dlgTitle, text);
},
alertCheck : function(dialogTitle, text, checkBoxLabel, checkObj)
@@ -1580,32 +1580,32 @@ function IsSupportedTextMimeType(aMimeTy
return false;
}
// throws an error or returns true if user attempted save; false if user canceled save
async function SaveDocument(aSaveAs, aSaveCopy, aMimeType)
{
var editor = GetCurrentEditor();
if (!aMimeType || !editor)
- throw Components.results.NS_ERROR_NOT_INITIALIZED;
+ throw Cr.NS_ERROR_NOT_INITIALIZED;
var editorDoc = editor.document;
if (!editorDoc)
- throw Components.results.NS_ERROR_NOT_INITIALIZED;
+ throw Cr.NS_ERROR_NOT_INITIALIZED;
// if we don't have the right editor type bail (we handle text and html)
var editorType = GetCurrentEditorType();
if (["text", "html", "htmlmail", "textmail"].indexOf(editorType) == -1)
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
var saveAsTextFile = IsSupportedTextMimeType(aMimeType);
// check if the file is to be saved is a format we don't understand; if so, bail
if (aMimeType != kHTMLMimeType && aMimeType != kXHTMLMimeType && !saveAsTextFile)
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
if (saveAsTextFile)
aMimeType = "text/plain";
var urlstring = GetDocumentUrl();
var mustShowFileDialog = (aSaveAs || IsUrlAboutBlank(urlstring) || (urlstring == ""));
// If editing a remote URL, force SaveAs dialog
@@ -1635,34 +1635,34 @@ async function SaveDocument(aSaveAs, aSa
replacing = (dialogResult.filepickerClick == nsIFilePicker.returnReplace);
urlstring = dialogResult.resultingURIString;
tempLocalFile = dialogResult.resultingLocalFile;
// update the new URL for the webshell unless we are saving a copy
if (!aSaveCopy)
doUpdateURI = true;
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
return false;
}
} // mustShowFileDialog
var success = true;
try {
// if somehow we didn't get a local file but we did get a uri,
// attempt to create the localfile if it's a "file" url
var docURI;
if (!tempLocalFile)
{
docURI = Services.io.newURI(urlstring, editor.documentCharacterSet);
if (docURI.schemeIs("file"))
{
var fileHandler = GetFileProtocolHandler();
- tempLocalFile = fileHandler.getFileFromURLSpec(urlstring).QueryInterface(Components.interfaces.nsIFile);
+ tempLocalFile = fileHandler.getFileFromURLSpec(urlstring).QueryInterface(Ci.nsIFile);
}
}
// this is the location where the related files will go
var relatedFilesDir = null;
// Only change links or move files if pref is set
// and we are saving to a new location
@@ -2049,22 +2049,22 @@ async function CloseWindow()
// Check to make sure document is saved. "true" means allow "Don't Save" button,
// so user can choose to close without saving
if (await CheckAndSaveDocument("cmd_close", true))
{
if (window.InsertCharWindow)
SwitchInsertCharToAnotherEditorOrClose();
try {
- var basewin = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+ var basewin = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIBaseWindow);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIBaseWindow);
basewin.destroy();
} catch (e) {}
}
}
//-----------------------------------------------------------------------------------
var nsOpenRemoteCommand =
{
@@ -2312,25 +2312,25 @@ var nsFindAgainCommand =
};
//-----------------------------------------------------------------------------------
var nsRewrapCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
return (IsDocumentEditable() && !IsInHTMLSourceMode() &&
- GetCurrentEditor() instanceof Components.interfaces.nsIEditorMailSupport);
+ GetCurrentEditor() instanceof Ci.nsIEditorMailSupport);
},
getCommandStateParams: function(aCommand, aParams, aRefCon) {},
doCommandParams: function(aCommand, aParams, aRefCon) {},
doCommand: function(aCommand)
{
- GetCurrentEditor().QueryInterface(Components.interfaces.nsIEditorMailSupport).rewrap(false);
+ GetCurrentEditor().QueryInterface(Ci.nsIEditorMailSupport).rewrap(false);
}
};
//-----------------------------------------------------------------------------------
var nsSpellingCommand =
{
isCommandEnabled: function(aCommand, dummy)
{
--- a/editor/ui/composer/content/editingOverlay.js
+++ b/editor/ui/composer/content/editingOverlay.js
@@ -59,28 +59,28 @@ function EditorOnLoad()
cmd.collapsed = true;
}
// Initialize our source text <editor>
try {
gSourceContentWindow = document.getElementById("content-source");
gSourceContentWindow.makeEditable("text", false);
gSourceTextEditor = gSourceContentWindow.getEditor(gSourceContentWindow.contentWindow);
- gSourceTextEditor.QueryInterface(Components.interfaces.nsIPlaintextEditor);
+ gSourceTextEditor.QueryInterface(Ci.nsIPlaintextEditor);
gSourceTextEditor.enableUndo(false);
gSourceTextEditor.rootElement.style.fontFamily = "-moz-fixed";
gSourceTextEditor.rootElement.style.whiteSpace = "pre";
gSourceTextEditor.rootElement.style.margin = 0;
- var controller = Components.classes["@mozilla.org/embedcomp/base-command-controller;1"]
- .createInstance(Components.interfaces.nsIControllerContext);
+ var controller = Cc["@mozilla.org/embedcomp/base-command-controller;1"]
+ .createInstance(Ci.nsIControllerContext);
controller.init(null);
controller.setCommandContext(gSourceContentWindow);
gSourceContentWindow.contentWindow.controllers.insertControllerAt(0, controller);
- var commandTable = controller.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIControllerCommandTable);
+ var commandTable = controller.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIControllerCommandTable);
commandTable.registerCommand("cmd_findReplace", nsFindReplaceCommand);
commandTable.registerCommand("cmd_find", nsFindCommand);
commandTable.registerCommand("cmd_findNext", nsFindAgainCommand);
commandTable.registerCommand("cmd_findPrev", nsFindAgainCommand);
} catch (e) {
dump("makeEditable failed: "+e+"\n");
}
}
@@ -160,21 +160,21 @@ var PrintPreviewListener = {
}
function EditorStartup(aUrl, aCharset)
{
gUntitledString = GetFormattedString("untitledTitle", GetNextUntitledValue());
var ds = GetCurrentEditorElement().docShell;
ds.useErrorPages = false;
- var root = ds.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
- .rootTreeItem.QueryInterface(Components.interfaces.nsIDocShell);
+ var root = ds.QueryInterface(Ci.nsIDocShellTreeItem)
+ .rootTreeItem.QueryInterface(Ci.nsIDocShell);
- root.QueryInterface(Components.interfaces.nsIDocShell).appType =
- Components.interfaces.nsIDocShell.APP_TYPE_EDITOR;
+ root.QueryInterface(Ci.nsIDocShell).appType =
+ Ci.nsIDocShell.APP_TYPE_EDITOR;
// EditorSharedStartup also used by Message Composer.
EditorSharedStartup();
// Commands specific to the Composer Application window,
// (i.e., not embedded editors)
// such as file-related commands, HTML Source editing, Edit Modes...
SetupComposerWindowCommands();
@@ -217,17 +217,17 @@ function EditorShutdown()
// --------------------------- File menu ---------------------------
// Check for changes to document and allow saving before closing
// This is hooked up to the OS's window close widget (e.g., "X" for Windows)
async function EditorCanClose(aCancelQuit, aTopic, aData)
{
if (aTopic == "quit-application-requested" &&
- aCancelQuit instanceof Components.interfaces.nsISupportsPRBool &&
+ aCancelQuit instanceof Ci.nsISupportsPRBool &&
aCancelQuit.data)
return false;
// Returns FALSE only if user cancels save action
// "true" means allow "Don't Save" button
var canClose = await CheckAndSaveDocument("cmd_close", true);
--- a/editor/ui/composer/content/editor.js
+++ b/editor/ui/composer/content/editor.js
@@ -51,17 +51,17 @@ var gReturnInParagraphPrefListener;
var gLocalFonts = null;
var gLastFocusNode = null;
var gLastFocusNodeWasSelected = false;
// These must be kept in synch with the XUL <options> lists
var gFontSizeNames = ["xx-small","x-small","small","medium","large","x-large","xx-large"];
-var nsIFilePicker = Components.interfaces.nsIFilePicker;
+var nsIFilePicker = Ci.nsIFilePicker;
var kEditorToolbarPrefs = "editor.toolbars.showbutton.";
var kUseCssPref = "editor.use_css";
var kCRInParagraphsPref = "editor.CR_creates_new_p";
function ShowHideToolbarSeparators(toolbar) {
// Make sure the toolbar actually exists.
if (!toolbar)
@@ -402,17 +402,17 @@ function SetFocusOnStartup()
gContentWindow.focus();
}
function EditorLoadUrl(url)
{
try {
if (url)
GetCurrentEditorElement().webNavigation.loadURI(url, // uri string
- Components.interfaces.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE, // load flags
+ Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE, // load flags
null, // referrer
null, // post-data stream
null);
} catch (e) { dump(" EditorLoadUrl failed: "+e+"\n"); }
}
// This should be called by all Composer types
function EditorSharedStartup()
@@ -1028,18 +1028,18 @@ const kFixedFontFaceMenuItems = 8;
function initLocalFontFaceMenu(menuPopup)
{
if (!gLocalFonts)
{
// Build list of all local fonts once per editor
try
{
- var enumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
- .getService(Components.interfaces.nsIFontEnumerator);
+ var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
+ .getService(Ci.nsIFontEnumerator);
var localFontCount = { value: 0 }
gLocalFonts = enumerator.EnumerateAllFonts(localFontCount);
}
catch(e) { }
}
// Don't use radios for menulists.
let useRadioMenuitems = (menuPopup.parentNode.localName == "menu");
@@ -1589,17 +1589,17 @@ function EditorDblClick(event)
// We check event.explicitOriginalTarget here because .target will never
// be a textnode (bug 193689)
if (event.explicitOriginalTarget)
{
// Only bring up properties if clicked on an element or selected link
var element;
try {
element = event.explicitOriginalTarget.QueryInterface(
- Components.interfaces.nsIDOMElement);
+ Ci.nsIDOMElement);
} catch (e) {}
// We use "href" instead of "a" to not be fooled by named anchor
if (!element)
try {
element = GetCurrentEditor().getSelectedElement("href");
} catch (e) {}
@@ -1623,17 +1623,17 @@ function EditorClick(event)
// except for body and table elements
if (gEditorDisplayMode == kDisplayModeAllTags)
{
try
{
// We check event.explicitOriginalTarget here because .target will never
// be a textnode (bug 193689)
var element = event.explicitOriginalTarget.QueryInterface(
- Components.interfaces.nsIDOMElement);
+ Ci.nsIDOMElement);
var name = element.localName;
if (!["body", "caption", "table", "td", "th", "tr"].includes(name))
{
GetCurrentEditor().selectElement(event.explicitOriginalTarget);
event.preventDefault();
}
} catch (e) {}
}
@@ -1895,17 +1895,17 @@ function SetDisplayMode(mode)
{
// Save the last non-source mode so we can cancel source editing easily
gPreviousNonSourceDisplayMode = mode;
// Load/unload appropriate override style sheet
try {
var editor = GetCurrentEditor();
editor.QueryInterface(nsIEditorStyleSheets);
- editor instanceof Components.interfaces.nsIHTMLObjectResizer;
+ editor instanceof Ci.nsIHTMLObjectResizer;
switch (mode)
{
case kDisplayModePreview:
// Disable all extra "edit mode" style sheets
editor.enableStyleSheet(kNormalStyleSheet, false);
editor.enableStyleSheet(kAllTagsStyleSheet, false);
editor.objectResizingEnabled = true;
@@ -3164,19 +3164,19 @@ function FillInHTMLTooltipEditor(tooltip
tooltip.setAttribute("label", tooltipText);
return true;
}
}
}
} else {
for (node = document.tooltipNode; node; node = node.parentNode) {
if (ChromeUtils.getClassName(node) === "HTMLImageElement" ||
- node instanceof Components.interfaces.nsIDOMHTMLInputElement)
+ node instanceof Ci.nsIDOMHTMLInputElement)
tooltipText = node.getAttribute("src");
- else if (node instanceof Components.interfaces.nsIDOMHTMLAnchorElement)
+ else if (node instanceof Ci.nsIDOMHTMLAnchorElement)
tooltipText = node.getAttribute("href") || node.name;
if (tooltipText) {
tooltip.setAttribute("label", tooltipText);
return true;
}
}
}
return false;
--- a/editor/ui/composer/content/editorUtilities.js
+++ b/editor/ui/composer/content/editorUtilities.js
@@ -9,24 +9,24 @@ ChromeUtils.import("resource://gre/modul
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
// Each editor window must include this file
// Variables shared by all dialogs:
// Object to attach commonly-used widgets (all dialogs should use this)
var gDialog = {};
-var kOutputEncodeBasicEntities = Components.interfaces.nsIDocumentEncoder.OutputEncodeBasicEntities;
-var kOutputEncodeHTMLEntities = Components.interfaces.nsIDocumentEncoder.OutputEncodeHTMLEntities;
-var kOutputEncodeLatin1Entities = Components.interfaces.nsIDocumentEncoder.OutputEncodeLatin1Entities;
-var kOutputEncodeW3CEntities = Components.interfaces.nsIDocumentEncoder.OutputEncodeW3CEntities;
-var kOutputFormatted = Components.interfaces.nsIDocumentEncoder.OutputFormatted;
-var kOutputLFLineBreak = Components.interfaces.nsIDocumentEncoder.OutputLFLineBreak;
-var kOutputSelectionOnly = Components.interfaces.nsIDocumentEncoder.OutputSelectionOnly;
-var kOutputWrap = Components.interfaces.nsIDocumentEncoder.OutputWrap;
+var kOutputEncodeBasicEntities = Ci.nsIDocumentEncoder.OutputEncodeBasicEntities;
+var kOutputEncodeHTMLEntities = Ci.nsIDocumentEncoder.OutputEncodeHTMLEntities;
+var kOutputEncodeLatin1Entities = Ci.nsIDocumentEncoder.OutputEncodeLatin1Entities;
+var kOutputEncodeW3CEntities = Ci.nsIDocumentEncoder.OutputEncodeW3CEntities;
+var kOutputFormatted = Ci.nsIDocumentEncoder.OutputFormatted;
+var kOutputLFLineBreak = Ci.nsIDocumentEncoder.OutputLFLineBreak;
+var kOutputSelectionOnly = Ci.nsIDocumentEncoder.OutputSelectionOnly;
+var kOutputWrap = Ci.nsIDocumentEncoder.OutputWrap;
var gStringBundle;
var gFilePickerDirectory;
/************* Message dialogs ***************/
// Optional: Caller may supply text to substitue for "Ok" and/or "Cancel"
function ConfirmWithTitle(title, message, okButtonText, cancelButtonText)
@@ -144,38 +144,38 @@ function GetSelectionAsText()
return GetCurrentEditor().outputToString("text/plain", kOutputSelectionOnly);
} catch (e) {}
return "";
}
/************* Get Current Editor and associated interfaces or info ***************/
-const nsIPlaintextEditor = Components.interfaces.nsIPlaintextEditor;
-const nsIHTMLEditor = Components.interfaces.nsIHTMLEditor;
-const nsITableEditor = Components.interfaces.nsITableEditor;
-const nsIEditorStyleSheets = Components.interfaces.nsIEditorStyleSheets;
-const nsIEditingSession = Components.interfaces.nsIEditingSession;
+const nsIPlaintextEditor = Ci.nsIPlaintextEditor;
+const nsIHTMLEditor = Ci.nsIHTMLEditor;
+const nsITableEditor = Ci.nsITableEditor;
+const nsIEditorStyleSheets = Ci.nsIEditorStyleSheets;
+const nsIEditingSession = Ci.nsIEditingSession;
function GetCurrentEditor()
{
// Get the active editor from the <editor> tag
// XXX This will probably change if we support > 1 editor in main Composer window
// (e.g. a plaintext editor for HTMLSource)
// For dialogs: Search up parent chain to find top window with editor
var editor;
try {
var editorElement = GetCurrentEditorElement();
editor = editorElement.getEditor(editorElement.contentWindow);
// Do QIs now so editor users won't have to figure out which interface to use
// Using "instanceof" does the QI for us.
- editor instanceof Components.interfaces.nsIPlaintextEditor;
- editor instanceof Components.interfaces.nsIHTMLEditor;
+ editor instanceof Ci.nsIPlaintextEditor;
+ editor instanceof Ci.nsIHTMLEditor;
} catch (e) { dump (e)+"\n"; }
return editor;
}
function GetCurrentTableEditor()
{
var editor = GetCurrentEditor();
@@ -297,17 +297,17 @@ function IsHTMLSourceChanged()
{
// gSourceTextEditor will not be defined if we're just a text editor.
return gSourceTextEditor ? gSourceTextEditor.documentModified : false;
}
function newCommandParams()
{
try {
- return Components.classes["@mozilla.org/embedcomp/command-params;1"].createInstance(Components.interfaces.nsICommandParams);
+ return Cc["@mozilla.org/embedcomp/command-params;1"].createInstance(Ci.nsICommandParams);
}
catch(e) { dump("error thrown in newCommandParams: "+e+"\n"); }
return null;
}
/************* General editing command utilities ***************/
function GetDocumentTitle()
@@ -385,17 +385,17 @@ function SetElementEnabled(element, doEn
}
}
/************* Services / Prefs ***************/
function GetFileProtocolHandler()
{
let handler = Services.io.getProtocolHandler("file");
- return handler.QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ return handler.QueryInterface(Ci.nsIFileProtocolHandler);
}
function GetStringPref(name)
{
try {
return Services.prefs.getStringPref(name);
} catch (e) {}
return "";
@@ -414,36 +414,36 @@ function SetFilePickerDirectory(filePick
{
if (filePicker)
{
try {
// Save current directory so we can reset it in SaveFilePickerDirectory
gFilePickerDirectory = filePicker.displayDirectory;
let location = Services.prefs.getComplexValue("editor.lastFileLocation."+fileType,
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
if (location)
filePicker.displayDirectory = location;
}
catch(e) {}
}
}
// Save the directory of the selected file to prefs
function SaveFilePickerDirectory(filePicker, fileType)
{
if (filePicker && filePicker.file)
{
try {
var fileDir;
if (filePicker.file.parent)
- fileDir = filePicker.file.parent.QueryInterface(Components.interfaces.nsIFile);
+ fileDir = filePicker.file.parent.QueryInterface(Ci.nsIFile);
Services.prefs.setComplexValue("editor.lastFileLocation." + fileType,
- Components.interfaces.nsIFile, fileDir);
+ Ci.nsIFile, fileDir);
Services.prefs.savePrefFile(null);
} catch (e) {}
}
// Restore the directory used before SetFilePickerDirectory was called;
// This reduces interference with Browser and other module directory defaults
if (gFilePickerDirectory)
@@ -723,17 +723,17 @@ function GetFilename(urlspec)
return "";
var filename;
try {
let uri = Services.io.newURI(urlspec);
if (uri)
{
- let url = uri.QueryInterface(Components.interfaces.nsIURL);
+ let url = uri.QueryInterface(Ci.nsIURL);
if (url)
filename = url.fileName;
}
} catch (e) {}
return filename ? filename : "";
}
--- a/editor/ui/composer/content/pref-editing.js
+++ b/editor/ui/composer/content/pref-editing.js
@@ -153,19 +153,19 @@ function SetBgAndFgColors(aSysPrefEnable
{
SetColorPreview("normalText", Services.prefs.getCharPref("browser.display.foreground_color"));
SetColorPreview("ColorPreview", Services.prefs.getCharPref("browser.display.background_color"));
}
}
function ChooseImageFile()
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
var editorBundle = document.getElementById("bundle_editor");
var title = editorBundle.getString("SelectImageFile");
fp.init(window, title, nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterImages);
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.file) {
return;
}
--- a/editor/ui/composer/content/publishprefs.js
+++ b/editor/ui/composer/content/publishprefs.js
@@ -837,18 +837,18 @@ function SavePassword(publishData)
Services.logins.removeLogin(logins[i]);
break;
}
}
// If SavePassword is true, add new password.
if (publishData.savePassword)
{
- let authInfo = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
- .createInstance(Components.interfaces.nsILoginInfo);
+ let authInfo = Cc["@mozilla.org/login-manager/loginInfo;1"]
+ .createInstance(Ci.nsILoginInfo);
authInfo.init(url, null, url, publishData.username, publishData.password,
"", "");
Services.logins.addLogin(authInfo);
}
return true;
}
--- a/editor/ui/dialogs/content/EdDialogCommon.js
+++ b/editor/ui/dialogs/content/EdDialogCommon.js
@@ -380,24 +380,24 @@ function onMoreFewer()
}
function SwitchToValidatePanel()
{
// no default implementation
// Only EdTableProps.js currently implements this
}
-const nsIFilePicker = Components.interfaces.nsIFilePicker;
+const nsIFilePicker = Ci.nsIFilePicker;
/**
* @return {Promise} URL spec of the file chosen, or null
*/
function GetLocalFileURL(filterType)
{
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
var fileType = "html";
if (filterType == "img")
{
fp.init(window, GetString("SelectImageFile"), nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterImages);
fileType = "image";
}
@@ -569,17 +569,17 @@ function SetRelativeCheckbox(checkbox)
if (!checkbox) {
checkbox = document.getElementById("MakeRelativeCheckbox");
if (!checkbox)
return;
}
var editor = GetCurrentEditor();
// Mail never allows relative URLs, so hide the checkbox
- if (editor && (editor.flags & Components.interfaces.nsIPlaintextEditor.eEditorMailMask))
+ if (editor && (editor.flags & Ci.nsIPlaintextEditor.eEditorMailMask))
{
checkbox.collapsed = true;
return;
}
var input = document.getElementById(checkbox.getAttribute("for"));
if (!input)
return;
@@ -951,17 +951,17 @@ function FillLinkMenulist(linkMenulist,
});
for (i = 0; i < anchorList.length; i++)
createMenuItem(menupopup,anchorList[i].anchor);
}
else
{
// Don't bother with named anchors in Mail.
- if (editor && (editor.flags & Components.interfaces.nsIPlaintextEditor.eEditorMailMask))
+ if (editor && (editor.flags & Ci.nsIPlaintextEditor.eEditorMailMask))
{
menupopup.remove();
linkMenulist.removeAttribute("enablehistory");
return;
}
var item = createMenuItem(menupopup, GetString("NoNamedAnchorsOrHeadings"));
item.setAttribute("disabled", "true");
}
--- a/editor/ui/dialogs/content/EdImageOverlay.js
+++ b/editor/ui/dialogs/content/EdImageOverlay.js
@@ -295,18 +295,18 @@ function LoadPreviewImage()
// We must have an absolute URL to preview it or remove it from the cache
imageSrc = MakeAbsoluteUrl(imageSrc);
if (GetScheme(imageSrc))
{
let uri = Services.io.newURI(imageSrc);
if (uri)
{
- let imgCache = Components.classes["@mozilla.org/image/cache;1"]
- .getService(Components.interfaces.imgICache);
+ let imgCache = Cc["@mozilla.org/image/cache;1"]
+ .getService(Ci.imgICache);
// This returns error if image wasn't in the cache; ignore that
imgCache.removeEntry(uri);
}
}
} catch(e) {}
if (gDialog.PreviewImage)
@@ -473,17 +473,17 @@ function ValidateImage()
}
else
{
var checkbox = document.getElementById("MakeRelativeCheckbox");
try
{
if (checkbox && !checkbox.checked)
{
- src = Services.uriFixup.createFixupURI(src, Components.interfaces.nsIURIFixup.FIXUP_FLAG_NONE).spec;
+ src = Services.uriFixup.createFixupURI(src, Ci.nsIURIFixup.FIXUP_FLAG_NONE).spec;
}
} catch (e) { }
globalElement.setAttribute("src", src);
}
let title = gDialog.titleInput.value.trim();
if (title)
--- a/editor/ui/dialogs/content/EdInsertMath.js
+++ b/editor/ui/dialogs/content/EdInsertMath.js
@@ -25,19 +25,19 @@ function Startup()
// Set initial focus
gDialog.input.focus();
// Load TeXZilla
// TeXZilla.js contains non-ASCII characters and explicitly sets
// window.TeXZilla, so we have to specify the charset parameter but don't
// need to worry about the targetObj parameter.
- Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
- .getService(Components.interfaces.mozIJSSubScriptLoader)
- .loadSubScript("chrome://editor/content/TeXZilla.js", {}, "UTF-8");
+ Cc["@mozilla.org/moz/jssubscript-loader;1"]
+ .getService(Ci.mozIJSSubScriptLoader)
+ .loadSubScript("chrome://editor/content/TeXZilla.js", {}, "UTF-8");
// Verify if the selection is on a <math> and initialize the dialog.
gDialog.oldMath = editor.getElementOrParentByTagName("math", null);
if (gDialog.oldMath) {
// When these attributes are absent or invalid, they default to "inline" and "ltr" respectively.
gDialog.mode.selectedIndex = gDialog.oldMath.getAttribute("display") == "block" ? 1 : 0;
gDialog.direction.selectedIndex = gDialog.oldMath.getAttribute("dir") == "rtl" ? 1 : 0;
gDialog.input.value = TeXZilla.getTeXSource(gDialog.oldMath);
@@ -105,17 +105,17 @@ function Startup()
}
function insertLaTeXCommand(aButton)
{
gDialog.input.focus();
// For a single math symbol, just use the insertText command.
if (aButton.label) {
- gDialog.input.editor.QueryInterface(Components.interfaces.nsIPlaintextEditor).insertText(aButton.label);
+ gDialog.input.editor.QueryInterface(Ci.nsIPlaintextEditor).insertText(aButton.label);
return;
}
// Otherwise, it's a LaTeX command with at least one argument...
var latex = TeXZilla.getTeXSource(aButton.firstChild);
var selectionStart = gDialog.input.selectionStart;
var selectionEnd = gDialog.input.selectionEnd;
@@ -135,17 +135,17 @@ function insertLaTeXCommand(aButton)
latexNewStart = 0;
latexNewEnd = latex.length;
} else {
// Otherwise, select the dots representing the next argument.
latexNewEnd = latexNewStart + 1;
}
// Update the input text and selection.
- gDialog.input.editor.QueryInterface(Components.interfaces.nsIPlaintextEditor).insertText(latex);
+ gDialog.input.editor.QueryInterface(Ci.nsIPlaintextEditor).insertText(latex);
gDialog.input.setSelectionRange(selectionStart + latexNewStart,
selectionStart + latexNewEnd);
updateMath();
}
function createCommandPanel(aCommandPanelList)
{
--- a/editor/ui/dialogs/content/EdInsertTable.js
+++ b/editor/ui/dialogs/content/EdInsertTable.js
@@ -36,17 +36,17 @@ function Startup()
gDialog.borderInput = document.getElementById("borderInput");
gDialog.widthPixelOrPercentMenulist = document.getElementById("widthPixelOrPercentMenulist");
gDialog.OkButton = document.documentElement.getButton("accept");
// Make a copy to use for AdvancedEdit
globalElement = gTableElement.cloneNode(false);
try {
if (Services.prefs.getBoolPref("editor.use_css") && IsHTMLEditor()
- && !(gActiveEditor.flags & Components.interfaces.nsIPlaintextEditor.eEditorMailMask))
+ && !(gActiveEditor.flags & Ci.nsIPlaintextEditor.eEditorMailMask))
{
// only for Composer and not for htmlmail
globalElement.setAttribute("style", "text-align: left;");
}
} catch (e) {}
// Initialize all widgets with image attributes
InitDialog();
--- a/editor/ui/dialogs/content/EdLinkChecker.js
+++ b/editor/ui/dialogs/content/EdLinkChecker.js
@@ -14,17 +14,17 @@ var gLinkCheckTimerID = 0;
var gRequestObserver =
{
// urichecker requires that we have an OnStartRequest even tho it's a nop.
onStartRequest: function(request, ctxt) { },
// onStopRequest is where we really handle the status.
onStopRequest: function(request, ctxt, status)
{
- var linkChecker = request.QueryInterface(Components.interfaces.nsIURIChecker);
+ var linkChecker = request.QueryInterface(Ci.nsIURIChecker);
if (linkChecker)
{
gNumLinksCalledBack++;
linkChecker.status = status;
for (var i = 0; i < gNumLinksCalledBack; i++)
{
if (linkChecker == gLinksBeingChecked[i])
gLinksBeingChecked[i].status = status;
@@ -65,40 +65,40 @@ function Startup()
// Set window location relative to parent window (based on persisted attributes)
SetWindowLocation();
// Loop over the nodes that have links:
for (let i = 0; i < objects.length; i++)
{
let refobj = objects.queryElementAt(gNumLinksToCheck,
- Components.interfaces.nsIURIRefObject);
+ Ci.nsIURIRefObject);
// Loop over the links in this node:
if (refobj)
{
try {
var uri;
while ((uri = refobj.GetNextURI()))
{
// Use the real class in netlib:
// Note that there may be more than one link per refobj
gURIRefObjects[gNumLinksToCheck] = refobj;
// Make a new nsIURIChecker
gLinksBeingChecked[gNumLinksToCheck]
- = Components.classes["@mozilla.org/network/urichecker;1"]
+ = Cc["@mozilla.org/network/urichecker;1"]
.createInstance()
- .QueryInterface(Components.interfaces.nsIURIChecker);
+ .QueryInterface(Ci.nsIURIChecker);
// XXX uri creation needs to be localized
gLinksBeingChecked[gNumLinksToCheck].init(GetIOService().newURI(uri));
gLinksBeingChecked[gNumLinksToCheck].asyncCheck(gRequestObserver, null);
// Add item
let linkChecker = gLinksBeingChecked[gNumLinksToCheck]
- .QueryInterface(Components.interfaces.nsIURIChecker);
+ .QueryInterface(Ci.nsIURIChecker);
SetItemStatus(linkChecker.name, "busy");
dump(" *** Linkcount = "+gNumLinksToCheck+"\n");
gNumLinksToCheck++;
}
} catch (e) { dump (" *** EXCEPTION\n"); }
}
}
// Done with the loop, now we can be prepared for the finish:
@@ -115,17 +115,17 @@ function LinkCheckTimeOut()
if (gNumLinksToCheck <= 0)
return;
gLinkCheckTimerID = 0;
gNumLinksToCheck = 0;
gStartedAllChecks = false;
for (var i=0; i < gLinksBeingChecked.length; i++)
{
- var linkChecker = gLinksBeingChecked[i].QueryInterface(Components.interfaces.nsIURIChecker);
+ var linkChecker = gLinksBeingChecked[i].QueryInterface(Ci.nsIURIChecker);
// nsIURIChecker status values:
// NS_BINDING_SUCCEEDED link is valid
// NS_BINDING_FAILED link is invalid (gave an error)
// NS_BINDING_ABORTED timed out, or cancelled
switch (linkChecker.status)
{
case 0: // NS_BINDING_SUCCEEDED
SetItemStatus(linkChecker.name, "done");
--- a/editor/ui/dialogs/content/EdReplace.js
+++ b/editor/ui/dialogs/content/EdReplace.js
@@ -59,18 +59,18 @@ function onLoad()
return;
}
// Get the nsIWebBrowserFind service:
gFindInst = editorElement.webBrowserFind;
try {
// get the find service, which stores global find state
- gFindService = Components.classes["@mozilla.org/find/find_service;1"]
- .getService(Components.interfaces.nsIFindService);
+ gFindService = Cc["@mozilla.org/find/find_service;1"]
+ .getService(Ci.nsIFindService);
} catch(e) { dump("No find service!\n"); gFindService = 0; }
// Init gReplaceDialog.
initDialogObject();
// Change "OK" to "Find".
//dialog.find.label = document.getElementById("fBLT").getAttribute("label");
@@ -226,17 +226,17 @@ function onReplaceAll()
return;
var findStr = gReplaceDialog.findInput.value;
var repStr = gReplaceDialog.replaceInput.value;
// Transfer dialog contents to the find service.
saveFindData();
- var finder = Components.classes["@mozilla.org/embedcomp/rangefind;1"].createInstance().QueryInterface(Components.interfaces.nsIFind);
+ var finder = Cc["@mozilla.org/embedcomp/rangefind;1"].createInstance().QueryInterface(Ci.nsIFind);
finder.caseSensitive = gReplaceDialog.caseSensitive.checked;
finder.findBackwards = gReplaceDialog.searchBackwards.checked;
// We want the whole operation to be undoable in one swell foop,
// so start a transaction:
gEditor.beginTransaction();
@@ -247,17 +247,17 @@ function onReplaceAll()
var selection = gEditor.selection;
var selecRange;
if (selection.rangeCount > 0)
selecRange = selection.getRangeAt(0);
var origRange = selecRange.cloneRange();
// We'll need a range for the whole document:
var wholeDocRange = gEditor.document.createRange();
- var rootNode = gEditor.rootElement.QueryInterface(Components.interfaces.nsIDOMNode);
+ var rootNode = gEditor.rootElement.QueryInterface(Ci.nsIDOMNode);
wholeDocRange.selectNodeContents(rootNode);
// And start and end points:
var endPt = gEditor.document.createRange();
if (gReplaceDialog.searchBackwards.checked)
{
endPt.setStart(wholeDocRange.startContainer, wholeDocRange.startOffset);
--- a/editor/ui/dialogs/content/EdSelectProps.js
+++ b/editor/ui/dialogs/content/EdSelectProps.js
@@ -480,22 +480,22 @@ function Startup()
UpdateSelectMultiple();
// Define a custom view for the tree
treeBoxObject = gDialog.tree.treeBoxObject;
treeBoxObject.view = {
QueryInterface : function QueryInterface(aIID)
{
- if (aIID.equals(Components.interfaces.nsITreeView) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsITreeView) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
// useful for debugging
get wrappedJSObject() { return this; },
get rowCount() { return itemArray.length; },
get selection() { return treeSelection; },
set selection(selection) { return treeSelection = selection; },
getRowProperties: function getRowProperties(index) { return ""; },
// could have used a wrapper for this
--- a/editor/ui/dialogs/content/EdSnapToGrid.js
+++ b/editor/ui/dialogs/content/EdSnapToGrid.js
@@ -9,17 +9,17 @@ function Startup()
{
gEditor = GetCurrentEditor();
if (!gEditor)
{
window.close();
return;
}
- gEditor instanceof Components.interfaces.nsIHTMLAbsPosEditor;
+ gEditor instanceof Ci.nsIHTMLAbsPosEditor;
gDialog.enableSnapToGrid = document.getElementById("enableSnapToGrid");
gDialog.sizeInput = document.getElementById("size");
gDialog.sizeLabel = document.getElementById("sizeLabel");
gDialog.unitLabel = document.getElementById("unitLabel");
// Initialize control values based on existing attributes
InitDialog()
--- a/editor/ui/dialogs/content/EdSpellCheck.js
+++ b/editor/ui/dialogs/content/EdSpellCheck.js
@@ -18,17 +18,17 @@ function Startup()
var editor = GetCurrentEditor();
if (!editor)
{
window.close();
return;
}
// Get the spellChecker shell
- gSpellChecker = Components.classes['@mozilla.org/editor/editorspellchecker;1'].createInstance(Components.interfaces.nsIEditorSpellCheck);
+ gSpellChecker = Cc['@mozilla.org/editor/editorspellchecker;1'].createInstance(Ci.nsIEditorSpellCheck);
if (!gSpellChecker)
{
dump("SpellChecker not found!!!\n");
window.close();
return;
}
// Start the spell checker module.
@@ -38,17 +38,17 @@ function Startup()
var skipBlockQuotes = window.arguments[1];
var enableSelectionChecking = window.arguments[2];
if (skipBlockQuotes)
filterContractId = "@mozilla.org/editor/txtsrvfiltermail;1";
else
filterContractId = "@mozilla.org/editor/txtsrvfilter;1";
- gSpellChecker.setFilter(Components.classes[filterContractId].createInstance(Components.interfaces.nsITextServicesFilter));
+ gSpellChecker.setFilter(Cc[filterContractId].createInstance(Ci.nsITextServicesFilter));
gSpellChecker.InitSpellChecker(editor, enableSelectionChecking, spellCheckStarted);
}
catch(ex) {
dump("*** Exception error: InitSpellChecker\n");
window.close();
return;
}
@@ -399,22 +399,22 @@ function Recheck()
SetWidgetsForMisspelledWord();
}
//TODO: Should we bother to add a "Recheck" method to interface?
try {
recheckLanguage = gSpellChecker.GetCurrentDictionary();
gSpellChecker.UninitSpellChecker();
// Clear the ignore all list.
- Components.classes["@mozilla.org/spellchecker/personaldictionary;1"]
- .getService(Components.interfaces.mozIPersonalDictionary)
- .endSession();
+ Cc["@mozilla.org/spellchecker/personaldictionary;1"]
+ .getService(Ci.mozIPersonalDictionary)
+ .endSession();
gSpellChecker.InitSpellChecker(GetCurrentEditor(), false, finishRecheck);
} catch(ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
}
function FillSuggestedList(misspelledWord)
{
var list = gDialog.SuggestedList;
// Clear the current contents of the list
--- a/editor/ui/nsComposerCmdLineHandler.js
+++ b/editor/ui/nsComposerCmdLineHandler.js
@@ -1,32 +1,32 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler;
-const nsISupportsString = Components.interfaces.nsISupportsString;
-const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
+const nsICommandLineHandler = Ci.nsICommandLineHandler;
+const nsISupportsString = Ci.nsISupportsString;
+const nsIWindowWatcher = Ci.nsIWindowWatcher;
function nsComposerCmdLineHandler() {}
nsComposerCmdLineHandler.prototype = {
get wrappedJSObject() {
return this;
},
/* nsISupports */
QueryInterface: XPCOMUtils.generateQI([nsICommandLineHandler]),
/* nsICommandLineHandler */
handle : function handle(cmdLine) {
- var args = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(nsISupportsString);
+ var args = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(nsISupportsString);
try {
var uristr = cmdLine.handleFlagWithParam("edit", false);
if (uristr == null) {
// Try the editor flag (used for general.startup.* prefs)
uristr = cmdLine.handleFlagWithParam("editor", false);
if (uristr == null)
return;
}
--- a/im/components/contentHandler.js
+++ b/im/components/contentHandler.js
@@ -14,17 +14,17 @@ var NS_ERROR_WONT_HANDLE_CONTENT = 0x805
function contentHandler() {
}
contentHandler.prototype = {
classID: Components.ID("{fda46332-1b03-4940-a30c-0997445d8e34}"),
_xpcom_factory: {
createInstance: function ch_factory_ci(outer, iid) {
if (outer)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return gContentHandler.QueryInterface(iid);
}
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentHandler]),
// nsIContentHandler
@@ -51,17 +51,17 @@ contentHandler.prototype = {
.getService(Ci.nsIExternalProtocolService)
.loadURI(aRequest.URI);
aRequest.cancel(Cr.NS_BINDING_ABORTED);
},
// nsIFactory
createInstance: function ch_CI(outer, iid) {
if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid);
},
lockFactory: function ch_lock(lock) {
// No-op.
}
};
--- a/im/components/devtools/content/webconsole-overlay.xul
+++ b/im/components/devtools/content/webconsole-overlay.xul
@@ -11,15 +11,15 @@
<!-- Workaround since devtools hardcodes navigator:browser, which makes
browserWindow null, which means it falls back to using the
webconsole.xul window to look for gViewSourceUtils. -->
<script type="application/javascript" src="chrome://global/content/viewSourceUtils.js"/>
<script type="application/javascript"><![CDATA[
var {classes: Cc, interfaces: Ci} = Components;
function openUILinkIn(url) {
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Ci.nsIExternalProtocolService)
- .loadURI(ios.newURI(url), window);
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(ios.newURI(url), window);
}
]]></script>
</window>
</overlay>
--- a/im/components/ibCommandLineHandler.js
+++ b/im/components/ibCommandLineHandler.js
@@ -31,18 +31,18 @@ ibCommandLineHandler.prototype = {
#ifdef XP_MACOSX
else {
// If we have no reason to show the account manager and the
// buddy list is not shown because of the -silent flag, we
// should avoid an early exit.
// The code in nsAppStartup::Run won't start the event loop if
// we don't have at least one window or one call to
// enterLastWindowClosingSurvivalArea.
- let as = Components.classes["@mozilla.org/toolkit/app-startup;1"]
- .getService(Ci.nsIAppStartup);
+ let as = Cc["@mozilla.org/toolkit/app-startup;1"]
+ .getService(Ci.nsIAppStartup);
as.enterLastWindowClosingSurvivalArea();
// We can exitLastWindowClosingSurvivalArea as soon as the
// load of our application provided hiddenWindow has begun.
executeSoon(function() { as.exitLastWindowClosingSurvivalArea(); });
}
#endif
}
},
--- a/im/components/mintrayr/content/mintrayr.js
+++ b/im/components/mintrayr/content/mintrayr.js
@@ -30,22 +30,22 @@ var gMinTrayR = {
let docElt = window.document.documentElement;
if (docElt.hasAttribute("storeScreenX"))
window.moveTo(docElt.getAttribute("storeScreenX"),
docElt.getAttribute("storeScreenY"));
#endif
#endif
this.trayService =
- Components.classes['@tn123.ath.cx/trayservice;1']
- .getService(Components.interfaces.trayITrayService);
+ Cc['@tn123.ath.cx/trayservice;1']
+ .getService(Ci.trayITrayService);
this.trayService.watchMinimize(window);
this._prefs = Services.prefs.getBranch("extensions.mintrayr.")
- .QueryInterface(Components.interfaces.nsIPrefBranch);
+ .QueryInterface(Ci.nsIPrefBranch);
this._prefs.addObserver("alwaysShowTrayIcon", this);
// Add a listener to minimize the window on startup once it has been
// fully created if the corresponding pref is set.
if (this._prefs.getBoolPref("startMinimized")) {
window.addEventListener("focus", () => {
if (gMinTrayR._prefs.getIntPref("minimizeon"))
gMinTrayR.minimize();
--- a/im/content/aboutDialog.xul
+++ b/im/content/aboutDialog.xul
@@ -34,31 +34,31 @@
#include menus.xul.inc
#endif
<script type="application/javascript">
<![CDATA[
var gSelectedPage;
function onLoad() {
- var xai = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULAppInfo);
+ var xai = Cc["@mozilla.org/xre/app-info;1"]
+ .getService(Ci.nsIXULAppInfo);
var versionField = document.getElementById("versionField");
versionField.value = versionField.value + xai.version
+ ' (' + xai.appBuildID + ')';
versionField = document.getElementById("geckoVersionField");
versionField.value = versionField.value + xai.platformVersion
+ ' (' + xai.platformBuildID + ')';
versionField = document.getElementById("libpurpleVersionField");
if ("@instantbird.org/libpurple/core;1" in Components.classes) {
- var pcs = Components.classes["@instantbird.org/libpurple/core;1"]
- .getService(Components.interfaces.purpleICoreService);
+ var pcs = Cc["@instantbird.org/libpurple/core;1"]
+ .getService(Ci.purpleICoreService);
versionField.value = versionField.value + pcs.version;
}
else {
versionField.hidden = true;
}
versionField = document.getElementById("userAgentField");
versionField.value = navigator.userAgent;
--- a/im/content/aboutPanel.xml
+++ b/im/content/aboutPanel.xml
@@ -65,18 +65,18 @@
let win = this.browser.contentWindow;
let open = win.open;
win.open = function(aUrl) {
let uri = Services.io.newURI(aUrl);
if (!uri.schemeIs("http") && !uri.schemeIs("https")) {
open.apply(this, arguments);
}
else {
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService).loadURI(uri);
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService).loadURI(uri);
}
}
]]>
</constructor>
</implementation>
<handlers>
<handler event="click">
@@ -110,16 +110,16 @@
return;
}
// If we couldn't add a new tab, load the page in this one.
this.showAboutPage(url);
return;
}
// Otherwise open in default browser.
// loadURI can throw if the default browser is misconfigured.
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
- .loadURI(Services.io.newURI(url));
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(Services.io.newURI(url));
]]>
</handler>
</handlers>
</binding>
</bindings>
--- a/im/content/accountWizard.js
+++ b/im/content/accountWizard.js
@@ -177,18 +177,18 @@ var accountWizard = {
/* FIXME
document.getElementById("newMailNotification").hidden =
!this.proto.newMailNotification;
*/
this.populateProtoSpecificBox();
let proxyVisible = this.proto.usePurpleProxy;
if (proxyVisible) {
- this.proxy = Components.classes["@instantbird.org/purple/proxyinfo;1"]
- .createInstance(Ci.purpleIProxyInfo);
+ this.proxy = Cc["@instantbird.org/purple/proxyinfo;1"]
+ .createInstance(Ci.purpleIProxyInfo);
this.proxy.type = Ci.purpleIProxyInfo.useGlobal;
this.displayProxyDescription();
}
document.getElementById("proxyGroupbox").hidden = !proxyVisible;
let alias = document.getElementById("alias");
alias.focus();
},
@@ -453,35 +453,35 @@ var accountWizard = {
/* Check for correctness and set URL for the "Get more protocols..."-link
* Stripped down code from preferences/themes.js
*/
setGetMoreProtocols: function (){
let prefURL = PREF_EXTENSIONS_GETMOREPROTOCOLSURL;
let getMore = document.getElementById("getMoreProtocols");
let showGetMore = false;
- const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
+ const nsIPrefBranch = Ci.nsIPrefBranch;
if (Services.prefs.getPrefType(prefURL) != nsIPrefBranch.PREF_INVALID) {
try {
- let getMoreURL = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
- .getService(Components.interfaces.nsIURLFormatter)
- .formatURLPref(prefURL);
+ let getMoreURL = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
+ .getService(Ci.nsIURLFormatter)
+ .formatURLPref(prefURL);
getMore.setAttribute("getMoreURL", getMoreURL);
showGetMore = getMoreURL != "about:blank";
}
catch (e) { }
}
getMore.hidden = !showGetMore;
},
openURL: function (aURL) {
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
- .loadURI(Services.io.newURI(aURL));
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(Services.io.newURI(aURL));
},
advanceTopProtocolPage: function() {
let selectedProtocol = document.getElementById("topprotolist").selectedItem;
if (!selectedProtocol || selectedProtocol.id == "otherListItem")
return true;
accountWizard.selectProtocol();
document.getElementById("accountWizard").goTo("accountusername");
--- a/im/content/blist.js
+++ b/im/content/blist.js
@@ -600,19 +600,19 @@ var buddyList = {
default:
if (aEvent.charCode == aEvent.DOM_VK_SPACE)
this.chooseUserIcon();
break;
}
},
chooseUserIcon: function bl_chooseUserIcon() {
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- let fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ let fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
let bundle = document.getElementById("instantbirdBundle");
fp.init(window, bundle.getString("userIconFilePickerTitle"),
nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterImages);
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.file) {
return;
}
--- a/im/content/contact.xml
+++ b/im/content/contact.xml
@@ -449,19 +449,19 @@
</implementation>
<handlers>
<handler event="blur">
<![CDATA[
if (!this.hasAttribute("aliasing"))
return;
let win =
- Components.classes["@mozilla.org/focus-manager;1"]
- .getService(Components.interfaces.nsIFocusManager)
- .activeWindow;
+ Cc["@mozilla.org/focus-manager;1"]
+ .getService(Ci.nsIFocusManager)
+ .activeWindow;
if (win == document.defaultView)
finishAliasing(true);
]]>
</handler>
<handler event="mousedown">
<![CDATA[
if (!this.hasAttribute("aliasing") && canOpenConversation() &&
--- a/im/content/conversation.xml
+++ b/im/content/conversation.xml
@@ -312,29 +312,29 @@
}
}
if (!account.connected) {
let errMsg;
if (Services.io.offline)
errMsg = this.bundle.GetStringFromName("networkOffline");
else if (account.statusInfo.statusType ==
- Components.interfaces.imIStatusInfo.STATUS_OFFLINE)
+ Ci.imIStatusInfo.STATUS_OFFLINE)
errMsg = this.bundle.GetStringFromName("statusOffline");
else {
errMsg = this.bundle.formatStringFromName("accountDisconnected",
[account.protocol.name, account.name], 2);
}
this._conv.systemMessage(errMsg, true);
return;
}
- let msg = Components.classes["@mozilla.org/txttohtmlconv;1"]
- .getService(Ci.mozITXTToHTMLConv)
- .scanTXT(aMsg, 0);
+ let msg = Cc["@mozilla.org/txttohtmlconv;1"]
+ .getService(Ci.mozITXTToHTMLConv)
+ .scanTXT(aMsg, 0);
if (account.HTMLEnabled) {
msg = msg.replace(/\n/g, "<br/>");
if (Services.prefs.getBoolPref("messenger.conversations.sendFormat")) {
let style = MessageFormat.getMessageStyle();
let proto = this._conv.account.protocol.id;
if (proto == "prpl-msn") {
if ("color" in style)
@@ -1031,32 +1031,32 @@
if (accelKeyPressed ||
!Services.prefs.getBoolPref("accessibility.typeaheadfind"))
document.getBindingParent(this).editor.focus();
// Returns for Ctrl+V
if (accelKeyPressed)
return;
- const masks = Components.interfaces.nsIDOMNSEvent;
+ const masks = Ci.nsIDOMNSEvent;
var modifiers = 0;
if (event.shiftKey)
modifiers |= masks.SHIFT_MASK;
if (event.ctrlKey)
modifiers |= masks.CONTROL_MASK;
if (event.altKey)
modifiers |= masks.ALT_MASK;
if (event.metaKey)
modifiers |= masks.META_MASK;
if (event.accelKey)
modifiers |= isMac ? masks.META_MASK : masks.CONTROL_MASK;
// resend the event
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindowUtils)
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils)
.sendKeyEvent(event.type, event.keyCode, event.charCode, modifiers);
]]>
</body>
</method>
<method name="browserDblClick">
<parameter name="event"/>
<body>
--- a/im/content/credits.xhtml
+++ b/im/content/credits.xhtml
@@ -157,21 +157,21 @@
}
function openContributors(aEvent)
{
// Always prevent the default action even if loading throws, to
// avoid replacing the current document with an external page.
aEvent.preventDefault();
- var ioService = Components.classes["@mozilla.org/network/io-service;1"].
- getService(Components.interfaces.nsIIOService);
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
- .loadURI(ioService.newURI(aEvent.target.href));
+ var ioService = Cc["@mozilla.org/network/io-service;1"].
+ getService(Ci.nsIIOService);
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(ioService.newURI(aEvent.target.href));
}
]]>
</script>
</head>
<body onload="init();" onunload="uninit();">
<div id="titleBox">
<img src="chrome://branding/content/about-credits.png" />
--- a/im/content/debug/debug.js
+++ b/im/content/debug/debug.js
@@ -14,33 +14,33 @@ var debug = {
"chrome,resizable,centerscreen");
},
inspector: function debug_inspector() {
inspectDOMDocument(document);
},
garbageCollect: function debug_garbageCollect() {
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindowUtils)
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils)
.garbageCollect();
},
forceOnline: function debug_forceOnline() {
var ios = Services.io;
ios.manageOfflineStatus = false;
ios.offline = false;
},
load: function debug_load() {
setTimeout(function() {
// Load the Window DataSource so that browser windows opened subsequent to DOM
// Inspector show up in the DOM Inspector's window list.
- var windowDS = Components.classes["@mozilla.org/rdf/datasource;1?name=window-mediator"]
- .getService(Components.interfaces.nsIWindowDataSource);
+ var windowDS = Cc["@mozilla.org/rdf/datasource;1?name=window-mediator"]
+ .getService(Ci.nsIWindowDataSource);
}, 0);
}
};
window.addEventListener("load", debug.load);
function debug_enumerateProtocols()
{
--- a/im/content/debug/fake/fake.js
+++ b/im/content/debug/fake/fake.js
@@ -180,19 +180,19 @@ var ib_icon_url = 'data:image/png;base64
'eH6CYflxyvPifLy8jtimLYPfiQOGoUvDozseQ7e9Xl16PIbyeg3l83lUVpZf5OeHjLy8kDc3N6jn5ATI' +
'zg4wcA2SkxOgubmb66576sA7kfjwf+n/Bosrq4txs09LgVKEKHT8BeXSEyqWRihPegI5Sg8GpeH3CWU7' +
'worHNDsSFna0RzcjnVqip8ljRjp0x4p4LLPfH491BWKRsCYdP5B9hJqTamualqfrIhfIUYosKWVISpV+' +
'Rez3e7asjZmT/+V/nEwSIXATMsuAAiAXCAJ+wMOAS24laxQ3YNEFtAEHWxsbTP7BMkMIDwNkiQ1K7f23' +
'EHCkkiTFwE231knmjgJ28gD2byn/MQL+fyn/6/89/v8AG+f1CR8WcKcAAAAASUVORK5CYII=';
var fake = {
load: function f_load() {
- if (!Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment)
- .get("FAKE"))
+ if (!Cc["@mozilla.org/process/environment;1"]
+ .getService(Ci.nsIEnvironment)
+ .get("FAKE"))
return;
dump("Fake load\n");
setTimeout(function() {
fake.fakeIt();
}, 1000);
},
@@ -209,18 +209,18 @@ var fake = {
new Account("tom.smith@hotmail.com", "prpl-msn"),
new Account("tom.smith@gmail.com/instantbird",
"prpl-jabber"),
new Account("tom.smith@yahoo.com", "prpl-yahoo"),
new Account("tom@irc.mozilla.org", "prpl-irc")];
for (let account of this.accounts)
Services.obs.notifyObservers(account, "account-added");
- var win = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
+ var win = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator)
.getMostRecentWindow("Messenger:accountWizard");
if (win)
win.close();
this.groups = [
"Contacts",
"Friends",
"Colleagues"
@@ -310,18 +310,18 @@ var fake = {
Services.core.globalUserStatus.displayName = "Tom Smith";
// Ugly :-(
document.getElementById("userIcon").src = ib_icon_url;
},
deleteAccounts: function f_deleteAccounts() {
if (!Services.accounts.getAccounts().hasMoreElements())
return;
- var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
+ var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Ci.nsIPromptService);
if (!prompts.confirm(window, "Are you sure you want to delete all accounts?",
"You are about to delete your accounts. Are you sure?"))
throw "user aborted the operation";
for (let acc of getIter(Services.accounts.getAccounts()))
Services.accounts.deleteAccount(acc.id);
}
};
--- a/im/content/debugLogPanel.xml
+++ b/im/content/debugLogPanel.xml
@@ -87,19 +87,19 @@
this.findbar.browser = this.browser;
]]>
</body>
</method>
<method name="copyDebugLog">
<body>
<![CDATA[
- Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper)
- .copyString(this.browser.contentDocument.body.textContent);
+ Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper)
+ .copyString(this.browser.contentDocument.body.textContent);
]]>
</body>
</method>
<method name="showDebugLog">
<body>
<![CDATA[
let accId = this.accountList.selectedItem.accountId;
--- a/im/content/engineManager.js
+++ b/im/content/engineManager.js
@@ -70,19 +70,19 @@ var gEngineManagerDialog = {
loadAddEngines: function engineManager_loadAddEngines() {
this.onOK();
var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].getService(Ci.nsIURLFormatter);
var url = formatter.formatURLPref("browser.search.searchEnginesURL");
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Ci.nsIExternalProtocolService)
- .loadURI(ios.newURI(url), window);
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(ios.newURI(url), window);
window.close();
},
remove: function engineManager_remove() {
gEngineView._engineStore.removeEngine(gEngineView.selectedEngine);
var index = gEngineView.selectedIndex;
gEngineView.rowCountChanged(index, -1);
--- a/im/content/instantbird.js
+++ b/im/content/instantbird.js
@@ -88,17 +88,17 @@ var XULBrowserWindow = {
overLink: "",
statusText: "",
QueryInterface: function (aIID) {
if (aIID.equals(Ci.nsISupportsWeakReference) ||
aIID.equals(Ci.nsIXULBrowserWindow) ||
aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
get statusTextField () {
return getTabBrowser().getStatusPanel();
},
setStatus: function (status) {
this.status = status;
--- a/im/content/jsTreeView.js
+++ b/im/content/jsTreeView.js
@@ -221,15 +221,15 @@ PROTO_TREE_VIEW.prototype = {
// Note that as we iterate through here, .length may grow
for (let i = 0; i < this._rowMap.length; i++) {
if (this._persistOpenMap.includes(this._rowMap[i].id))
this.toggleOpenState(i);
}
},
QueryInterface: function QueryInterface(aIID) {
- if (aIID.equals(Components.interfaces.nsITreeView) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsITreeView) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
};
--- a/im/content/menus.js
+++ b/im/content/menus.js
@@ -62,21 +62,21 @@ var menus = {
updates: function menu_updates() {
Core.showUpdates();
},
displayUpdateStatus: function menu_displayUpdateStatus() {
// copied from buildHelpMenu in mozilla/browser/base/content/utilityOverlay.js
var updates =
- Components.classes["@mozilla.org/updates/update-service;1"]
- .getService(Components.interfaces.nsIApplicationUpdateService);
+ Cc["@mozilla.org/updates/update-service;1"]
+ .getService(Ci.nsIApplicationUpdateService);
var um =
- Components.classes["@mozilla.org/updates/update-manager;1"]
- .getService(Components.interfaces.nsIUpdateManager);
+ Cc["@mozilla.org/updates/update-manager;1"]
+ .getService(Ci.nsIUpdateManager);
// Disable the UI if the update enabled pref has been locked by the
// administrator or if we cannot update for some other reason
var checkForUpdates = document.getElementById("updatesMenuItem");
var canCheckForUpdates = updates.canCheckForUpdates;
checkForUpdates.setAttribute("disabled", !canCheckForUpdates);
if (!canCheckForUpdates)
return;
--- a/im/content/newtab.xml
+++ b/im/content/newtab.xml
@@ -30,18 +30,18 @@
</xul:vbox>
</content>
<implementation implements="nsIObserver">
<property name="statsService" readonly="true">
<getter>
<![CDATA[
if (!this._statsService) {
- this._statsService = Components.classes["@instantbird.org/conv-stats-service;1"]
- .getService(Components.interfaces.ibIConvStatsService);
+ this._statsService = Cc["@instantbird.org/conv-stats-service;1"]
+ .getService(Ci.ibIConvStatsService);
}
return this._statsService;
]]>
</getter>
</property>
<property name="filterbox" readonly="true">
<getter>
@@ -158,17 +158,17 @@
</method>
<method name="getNextConv">
<body>
<![CDATA[
if (!this.hasMoreConversations)
return null;
return this.filteredConvs.getNext()
- .QueryInterface(Components.interfaces.ibIPossibleConversation);
+ .QueryInterface(Ci.ibIPossibleConversation);
]]>
</body>
</method>
<!-- Remove observers when closing tab. -->
<method name="destroy">
<body>
<![CDATA[
@@ -234,17 +234,17 @@
<!-- Dispatch a call to _delayedRefresh, to avoid multiple consecutive calls. -->
<method name="refresh">
<body>
<![CDATA[
if (this._pendingRefreshCall)
return;
this._pendingRefreshCall = true;
Services.tm.mainThread.dispatch(this._delayedRefresh.bind(this),
- Components.interfaces.nsIEventTarget.DISPATCH_NORMAL);
+ Ci.nsIEventTarget.DISPATCH_NORMAL);
]]>
</body>
</method>
<field name="_prevFilterTxt">null</field>
<method name="_delayedRefresh">
<body>
<![CDATA[
--- a/im/content/preferences/advanced.js
+++ b/im/content/preferences/advanced.js
@@ -276,18 +276,18 @@ var gAdvancedPane = {
if (!enabledPref.value) // Don't care for autoPref.value in this case.
radiogroup.value="manual"; // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
radiogroup.value="auto"; // 1. Automatically install updates for Desktop only
else // enabledPref.value && !autoPref.value
radiogroup.value="checkOnly"; // 2. Check, but let me choose
- var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
- getService(Components.interfaces.nsIApplicationUpdateService).
+ var canCheck = Cc["@mozilla.org/updates/update-service;1"].
+ getService(Ci.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
var modePref = document.getElementById("app.update.mode");
var warnIncompatible = document.getElementById("warnIncompatible");
@@ -295,36 +295,36 @@ var gAdvancedPane = {
warnIncompatible.disabled = radiogroup.disabled || modePref.locked ||
!enabledPref.value || !autoPref.value;
#ifdef MOZ_MAINTENANCE_SERVICE
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
var installed;
try {
- var wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
- .createInstance(Components.interfaces.nsIWindowsRegKey);
+ var wrk = Cc["@mozilla.org/windows-registry-key;1"]
+ .createInstance(Ci.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
installed = wrk.readIntValue("Installed");
wrk.close();
} catch(e) {
}
if (installed != 1) {
document.getElementById("useService").hidden = true;
}
try {
const DRIVE_FIXED = 3;
const LPCWSTR = ctypes.char16_t.ptr;
const UINT = ctypes.uint32_t;
let kernel32 = ctypes.open("kernel32");
let GetDriveType = kernel32.declare("GetDriveTypeW", ctypes.default_abi, UINT, LPCWSTR);
- var UpdatesDir = Components.classes["@mozilla.org/updates/update-service;1"].
- getService(Components.interfaces.nsIApplicationUpdateService);
+ var UpdatesDir = Cc["@mozilla.org/updates/update-service;1"].
+ getService(Ci.nsIApplicationUpdateService);
let rootPath = UpdatesDir.getUpdatesDirectory();
while (rootPath.parent != null) {
rootPath = rootPath.parent;
}
if (GetDriveType(rootPath.path) != DRIVE_FIXED) {
document.getElementById("useService").hidden = true;
}
kernel32.close();
@@ -404,18 +404,18 @@ var gAdvancedPane = {
return !warnIncompatible.checked ? 0 : gAdvancedPane._modePreference;
},
/**
* Displays the history of installed updates.
*/
showUpdates: function ()
{
- var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
- .createInstance(Components.interfaces.nsIUpdatePrompt);
+ var prompter = Cc["@mozilla.org/updates/update-prompt;1"]
+ .createInstance(Ci.nsIUpdatePrompt);
prompter.showUpdateHistory(window);
},
#endif
// ENCRYPTION TAB
/*
* Preferences:
--- a/im/content/preferences/connection.js
+++ b/im/content/preferences/connection.js
@@ -100,18 +100,18 @@ var gConnectionsDialog = {
// if the current value of the PAC textbox does not match the value stored
// in prefs. Likewise, disable the reload button if PAC is not configured
// in prefs.
var typedURL = document.getElementById("networkProxyAutoconfigURL").value;
var proxyTypeCur = document.getElementById("network.proxy.type").value;
var prefs =
- Components.classes["@mozilla.org/preferences-service;1"].
- getService(Components.interfaces.nsIPrefBranch);
+ Cc["@mozilla.org/preferences-service;1"].
+ getService(Ci.nsIPrefBranch);
var pacURL = prefs.getCharPref("network.proxy.autoconfig_url");
var proxyType = prefs.getIntPref("network.proxy.type");
var disableReloadPref =
document.getElementById("pref.advanced.proxies.disable_button.reload");
disableReloadPref.disabled =
(proxyTypeCur != 2 || proxyType != 2 || typedURL != pacURL);
},
@@ -165,26 +165,26 @@ var gConnectionsDialog = {
}
var backupPref = document.getElementById("network.proxy.backup." + aProtocol + (aIsPort ? "_port" : ""));
return backupPref.hasUserValue ? backupPref.value : undefined;
},
reloadPAC: function ()
{
- Components.classes["@mozilla.org/network/protocol-proxy-service;1"].
+ Cc["@mozilla.org/network/protocol-proxy-service;1"].
getService().reloadPAC();
},
doAutoconfigURLFixup: function ()
{
var autoURL = document.getElementById("networkProxyAutoconfigURL");
var autoURLPref = document.getElementById("network.proxy.autoconfig_url");
- var URIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
- .getService(Components.interfaces.nsIURIFixup);
+ var URIFixup = Cc["@mozilla.org/docshell/urifixup;1"]
+ .getService(Ci.nsIURIFixup);
try {
autoURLPref.value = autoURL.value = URIFixup.createFixupURI(autoURL.value, 0).spec;
} catch(ex) {}
},
sanitizeNoProxiesPref: function()
{
var noProxiesPref = document.getElementById("network.proxy.no_proxies_on");
--- a/im/content/preferences/themes.js
+++ b/im/content/preferences/themes.js
@@ -29,22 +29,22 @@ var gThemePane = {
prefURL = PREF_EXTENSIONS_GETMOREMESSAGESTYLESURL;
break;
default:
return;
}
var getMore = document.getElementById("getMore" + aType);
var showGetMore = false;
- const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
+ const nsIPrefBranch = Ci.nsIPrefBranch;
if (Services.prefs.getPrefType(prefURL) != nsIPrefBranch.PREF_INVALID) {
try {
- var getMoreURL = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
- .getService(Components.interfaces.nsIURLFormatter)
- .formatURLPref(prefURL);
+ var getMoreURL = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
+ .getService(Ci.nsIURLFormatter)
+ .formatURLPref(prefURL);
getMore.setAttribute("getMoreURL", getMoreURL);
showGetMore = getMoreURL != "about:blank";
}
catch (e) { }
}
getMore.hidden = !showGetMore;
},
@@ -86,19 +86,19 @@ var gThemePane = {
// Set it to deactivated if it is not active;
// this is independent from the reason displayed.
if (!aItem.isActive || aItem.userDisabled)
item.setAttribute("disabled", "true");
});
},
openURL: function (aURL) {
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
- .loadURI(Services.io.newURI(aURL));
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(Services.io.newURI(aURL));
},
// Getting the extension list is slow, return a cached copy of the list
getExtensionList: function () {
if (!this.extensionList)
throw "The add-ons list should be loaded by now...";
return this.extensionList;
}
--- a/im/content/proxies.js
+++ b/im/content/proxies.js
@@ -37,18 +37,18 @@ var gProxies = {
proxyInfo = new proxyInfoCtr();
proxyInfo.type = Ci.purpleIProxyInfo.noProxy;
document.getElementById("noProxy").proxy = proxyInfo;
var useEnv = document.getElementById("useEnvironment");
proxyInfo = new proxyInfoCtr();
proxyInfo.type = Ci.purpleIProxyInfo.useEnvVar;
useEnv.proxy = proxyInfo;
- var environment = Components.classes["@mozilla.org/process/environment;1"]
- .getService(Ci.nsIEnvironment);
+ var environment = Cc["@mozilla.org/process/environment;1"]
+ .getService(Ci.nsIEnvironment);
var envproxy = environment.get("HTTP_PROXY") ||
environment.get("http_proxy") ||
environment.get("HTTPPROXY");
if (envproxy)
document.getElementById("envProxy").textContent = envproxy;
var proxies = getIter(pcs.getProxies());
var proxyList = document.getElementById("proxylist");
--- a/im/content/tabbrowser.xml
+++ b/im/content/tabbrowser.xml
@@ -293,33 +293,33 @@
if (tabKeyCodes.includes(event.keyCode))
return;
// Focus the panel and pass the key to it.
event.preventDefault();
event.stopPropagation();
this.selectedPanel.focus();
- const masks = Components.interfaces.nsIDOMNSEvent;
+ const masks = Ci.nsIDOMNSEvent;
var modifiers = 0;
if (event.shiftKey)
modifiers |= masks.SHIFT_MASK;
if (event.ctrlKey)
modifiers |= masks.CONTROL_MASK;
if (event.altKey)
modifiers |= masks.ALT_MASK;
if (event.metaKey)
modifiers |= masks.META_MASK;
if (event.accelKey)
modifiers |= (navigator.platform.includes("Mac")) ? masks.META_MASK
: masks.CONTROL_MASK;
// Can't use dispatchEvent to the textbox as these refuse untrusted key events.
this.selectedPanel.ownerDocument.defaultView
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindowUtils)
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils)
.sendKeyEvent(event.type, event.keyCode, event.charCode, modifiers);
]]>
</body>
</method>
<method name="onTabClick">
<parameter name="aEvent"/>
<body>
@@ -486,17 +486,17 @@
this.mPanelContainer.appendChild(aPanel);
var t = this.mTabContainer.addTab();
aPanel.tab = t;
if (aPanel.browser)
t.linkedBrowser = aPanel.browser;
if (aConv) {
- aConv.QueryInterface(Components.interfaces.imIConversation);
+ aConv.QueryInterface(Ci.imIConversation);
// set up the shared autoscroll popup if it doesn't exist yet
if (!this._autoScrollPopup) {
this._autoScrollPopup = aPanel.browser._createAutoScrollPopup();
this._autoScrollPopup.id = "autoscroller";
this.appendChild(this._autoScrollPopup);
}
aPanel.setAttribute("contenttooltip", this.getAttribute("contenttooltip"));
aPanel.setAttribute("contentcontextmenu", this.getAttribute("contentcontextmenu"));
@@ -883,17 +883,17 @@
<method name="getStatusPanel">
<body><![CDATA[
// These two methods are kept close to the original, but note
// that unlike the tabbrowser.xml in browser/, we need to add
// a statuspanel to all tab panels with a browser element.
if (!this.selectedBrowser) {
- Components.utils.reportError("Browser element in a tab panel " +
+ Cu.reportError("Browser element in a tab panel " +
"without a browser property");
return null;
}
let statusPanel = this.selectedPanel._statusPanel;
if (!statusPanel) {
statusPanel =
document.createElementNS(this.namespaceURI, "statuspanel");
@@ -1190,18 +1190,18 @@
in the current window, in which case this will do nothing. -->
<method name="replaceTabsWithWindow">
<parameter name="aTabs"/>
<body>
<![CDATA[
if (this.mTabs.length == 1)
return null;
- var ma = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var ma = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
aTabs.forEach(function(aTab) { ma.appendElement(aTab); });
// tell a new window to take the "dropped" tab
return Services.ww.openWindow(window,
getConvWindowURL(),
null,
"chrome,dialog=no,all",
ma);
@@ -1972,22 +1972,22 @@
null
</field>
<constructor><![CDATA[
// We cannot cache the XULBrowserWindow object itself since it might
// be set after this binding is constructed.
try {
this._xulWindow =
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIXULWindow);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIXULWindow);
}
catch(ex) { }
]]></constructor>
<method name="_menuItemOnCommand">
<parameter name="aEvent"/>
<body><![CDATA[
--- a/im/modules/ibCore.jsm
+++ b/im/modules/ibCore.jsm
@@ -38,31 +38,31 @@ var Core = {
false, true);
}
},
init: function() {
try {
// Set the Vendor for breakpad only
if ("nsICrashReporter" in Ci) {
- Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Ci.nsICrashReporter)
- .annotateCrashReport("Vendor", "Instantbird");
+ Cc["@mozilla.org/xre/app-info;1"]
+ .getService(Ci.nsICrashReporter)
+ .annotateCrashReport("Vendor", "Instantbird");
}
} catch(e) {
// This can fail if breakpad isn't enabled,
// don't worry too much about this exception.
}
if (!Ci.imICoreService) {
this._promptError("startupFailure.purplexpcomFileError");
return false;
}
- if (!Components.classes["@mozilla.org/chat/core-service;1"]) {
+ if (!Cc["@mozilla.org/chat/core-service;1"]) {
this._promptError("startupFailure.xpcomRegistrationError");
return false;
}
// Trigger asynchronous initialization of the password service.
Services.logins.initializationPromise.catch(() => {
this._promptError("startupFailure.passwordServiceError");
});
@@ -103,22 +103,22 @@ var Core = {
priority: Ci.imICommand.CMD_PRIORITY_DEFAULT,
run: function (aMsg, aConv) {
let page = aMsg.replace(/^about:/, "");
let url = "about:" + page;
// If the page doesn't exist, we avoid opening a tab.
try {
Services.io.newChannelFromURI(Services.io.newURI(url));
} catch(e) {
- if (e.result == Components.results.NS_ERROR_MALFORMED_URI) {
+ if (e.result == Cr.NS_ERROR_MALFORMED_URI) {
Services.conversations.getUIConversation(aConv).systemMessage(
self.bundle("aboutCommand.invalidPageMessage", page));
return true;
}
- Components.utils.reportError(e); // Log unexpected errors.
+ Cu.reportError(e); // Log unexpected errors.
return false;
}
self.showTab("aboutPanel", aPanel => aPanel.showAboutPage(page));
return true;
}
});
Services.cmd.registerCommand({
@@ -175,21 +175,21 @@ var Core = {
this.showWindow("Messenger:Preferences",
"chrome://instantbird/content/preferences/preferences.xul",
"Preferences",
"chrome,titlebar,toolbar,centerscreen,dialog=no");
},
showUpdates: function() {
// copied from checkForUpdates in mozilla/browser/base/content/utilityOverlay.js
var um =
- Components.classes["@mozilla.org/updates/update-manager;1"]
- .getService(Components.interfaces.nsIUpdateManager);
+ Cc["@mozilla.org/updates/update-manager;1"]
+ .getService(Ci.nsIUpdateManager);
var prompter =
- Components.classes["@mozilla.org/updates/update-prompt;1"]
- .createInstance(Components.interfaces.nsIUpdatePrompt);
+ Cc["@mozilla.org/updates/update-prompt;1"]
+ .createInstance(Ci.nsIUpdatePrompt);
// If there's an update ready to be applied, show the "Update Downloaded"
// UI instead and let the user know they have to restart the browser for
// the changes to be applied.
if (um.activeUpdate && um.activeUpdate.state == "pending")
prompter.showUpdateDownloaded(um.activeUpdate);
else
prompter.checkForUpdates();
@@ -309,17 +309,17 @@ var Core = {
clearTimeout(this._pendingShowAccountManager);
this._pendingShowAccountManager = true;
return;
}
},
_onQuitRequest: function (aCancelQuit, aQuitType) {
// The request has already been canceled somewhere else
- if ((aCancelQuit instanceof Components.interfaces.nsISupportsPRBool)
+ if ((aCancelQuit instanceof Ci.nsISupportsPRBool)
&& aCancelQuit.data)
return;
if (!Services.prefs.getBoolPref("messenger.warnOnQuit"))
return;
let unreadConvsCount =
Services.conversations.getUIConversations()
@@ -361,17 +361,17 @@ var Core = {
_promptError: function(aKeyString, aMessage) {
var bundle = this.bundle;
var title = bundle("startupFailure.title");
var message = bundle("startupFailure.apologize") + "\n\n" +
(aMessage ? bundle(aKeyString, aMessage)
: bundle(aKeyString) + "\n\n" + bundle("startupFailure.update"));
- const nsIPromptService = Components.interfaces.nsIPromptService;
+ const nsIPromptService = Ci.nsIPromptService;
const flags =
nsIPromptService.BUTTON_POS_1 * nsIPromptService.BUTTON_TITLE_IS_STRING +
nsIPromptService.BUTTON_POS_0 * nsIPromptService.BUTTON_TITLE_IS_STRING;
var prompts = Services.prompt;
if (!prompts.confirmEx(null, title, message, flags,
bundle("startupFailure.buttonUpdate"),
bundle("startupFailure.buttonClose"),
--- a/im/modules/ibNotifications.jsm
+++ b/im/modules/ibNotifications.jsm
@@ -11,31 +11,31 @@ ChromeUtils.import("resource:///modules/
var Notifications = {
get ellipsis () {
let ellipsis = "[\u2026]";
try {
ellipsis =
Services.prefs.getComplexValue("intl.ellipsis",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
} catch (e) { }
return ellipsis;
},
_showMessageNotification: function (aMessage) {
// Put the message content into a div node of the hidden HTML window.
let doc = getHiddenHTMLWindow().document;
let xhtmlElement = doc.createElementNS("http://www.w3.org/1999/xhtml", "div");
xhtmlElement.innerHTML = aMessage.displayMessage.replace(/<br>/gi, "<br/>");
// Convert the div node content to plain text.
let encoder =
- Components.classes["@mozilla.org/layout/documentEncoder;1?type=text/plain"]
- .createInstance(Components.interfaces.nsIDocumentEncoder);
+ Cc["@mozilla.org/layout/documentEncoder;1?type=text/plain"]
+ .createInstance(Ci.nsIDocumentEncoder);
encoder.init(doc, "text/plain", 0);
encoder.setNode(xhtmlElement);
let messageText = encoder.encodeToString().replace(/\s+/g, " ");
// Crop the end of the text if needed.
if (messageText.length > 50)
messageText = messageText.substr(0, 50) + this.ellipsis;
@@ -60,19 +60,19 @@ var Notifications = {
};
// Handle third person messages
let name = aMessage.alias || aMessage.who;
if (messageText.startsWith("/me "))
messageText = messageText.replace(/^\/me/, name);
// Finally show the notification!
- Components.classes["@mozilla.org/alerts-service;1"]
- .getService(Components.interfaces.nsIAlertsService)
- .showAlertNotification(icon, name, messageText, true, "", observer);
+ Cc["@mozilla.org/alerts-service;1"]
+ .getService(Ci.nsIAlertsService)
+ .showAlertNotification(icon, name, messageText, true, "", observer);
},
init: function() {
Services.obs.addObserver(Notifications, "new-text");
},
_notificationPrefName: "messenger.options.notifyOfNewMessages",
observe: function(aSubject, aTopic, aData) {
--- a/im/modules/imWindows.jsm
+++ b/im/modules/imWindows.jsm
@@ -79,19 +79,19 @@ var Conversations = {
// for a new window. In this case the conversation will be focused
// automatically anyway.
if (this.isUIConversationDisplayed(uiConv)) {
let conv = this._uiConv[uiConv.id];
let doc = conv.ownerDocument;
doc.getElementById("conversations").selectPanel(conv);
doc.defaultView.focus();
#ifdef XP_MACOSX
- Components.classes["@mozilla.org/widget/macdocksupport;1"]
- .getService(Components.interfaces.nsIMacDockSupport)
- .activateApplication(true);
+ Cc["@mozilla.org/widget/macdocksupport;1"]
+ .getService(Ci.nsIMacDockSupport)
+ .activateApplication(true);
#endif
}
return uiConv;
},
onWindowFocus: function (aWindow) {
let position = this._windows.indexOf(aWindow);
if (position != -1) {
--- a/ldap/xpcom/src/nsLDAPProtocolHandler.js
+++ b/ldap/xpcom/src/nsLDAPProtocolHandler.js
@@ -1,52 +1,52 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const kNetworkProtocolCIDPrefix = "@mozilla.org/network/protocol;1?name=";
-const nsIProtocolHandler = Components.interfaces.nsIProtocolHandler;
+const nsIProtocolHandler = Ci.nsIProtocolHandler;
function makeProtocolHandler(aCID, aProtocol, aDefaultPort) {
return {
classID: Components.ID(aCID),
QueryInterface: XPCOMUtils.generateQI([nsIProtocolHandler]),
scheme: aProtocol,
defaultPort: aDefaultPort,
protocolFlags: nsIProtocolHandler.URI_NORELATIVE |
nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
nsIProtocolHandler.ALLOWS_PROXY,
newURI: function (aSpec, aOriginCharset, aBaseURI) {
- var url = Components.classes["@mozilla.org/network/ldap-url;1"]
- .createInstance(Components.interfaces.nsIURI);
+ var url = Cc["@mozilla.org/network/ldap-url;1"]
+ .createInstance(Ci.nsIURI);
- if (url instanceof Components.interfaces.nsILDAPURL)
- url.init(Components.interfaces.nsIStandardURL.URLTYPE_STANDARD,
+ if (url instanceof Ci.nsILDAPURL)
+ url.init(Ci.nsIStandardURL.URLTYPE_STANDARD,
aDefaultPort, aSpec, aOriginCharset, aBaseURI);
return url;
},
newChannel: function (aURI) {
return this.newChannel2(aURI, null);
},
newChannel2: function (aURI, aLoadInfo) {
if ("@mozilla.org/network/ldap-channel;1" in Components.classes) {
- var channel = Components.classes["@mozilla.org/network/ldap-channel;1"]
- .createInstance(Components.interfaces.nsIChannel);
+ var channel = Cc["@mozilla.org/network/ldap-channel;1"]
+ .createInstance(Ci.nsIChannel);
channel.init(aURI);
return channel;
}
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
allowPort: function (port, scheme) {
return port == aDefaultPort;
}
};
}
--- a/mail/base/content/ABSearchDialog.js
+++ b/mail/base/content/ABSearchDialog.js
@@ -5,21 +5,21 @@
ChromeUtils.import("resource:///modules/ABQueryUtils.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
var searchSessionContractID = "@mozilla.org/messenger/searchSession;1";
var gSearchSession;
-var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
-var nsIMsgSearchTerm = Components.interfaces.nsIMsgSearchTerm;
-var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
-var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
-var nsIAbDirectory = Components.interfaces.nsIAbDirectory;
+var nsMsgSearchScope = Ci.nsMsgSearchScope;
+var nsIMsgSearchTerm = Ci.nsIMsgSearchTerm;
+var nsMsgSearchOp = Ci.nsMsgSearchOp;
+var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
+var nsIAbDirectory = Ci.nsIAbDirectory;
var gStatusText;
var gSearchBundle;
var gAddressBookBundle;
var gSearchStopButton;
var gPropertiesCmd;
var gComposeCmd;
@@ -48,22 +48,22 @@ function searchOnLoad()
{
initializeSearchWidgets();
initializeSearchWindowWidgets();
gSearchBundle = document.getElementById("bundle_search");
gSearchStopButton.setAttribute("label", gSearchBundle.getString("labelForSearchButton"));
gSearchStopButton.setAttribute("accesskey", gSearchBundle.getString("labelForSearchButton.accesskey"));
gAddressBookBundle = document.getElementById("bundle_addressBook");
- gSearchSession = Components.classes[searchSessionContractID].createInstance(Components.interfaces.nsIMsgSearchSession);
+ gSearchSession = Cc[searchSessionContractID].createInstance(Ci.nsIMsgSearchSession);
// initialize a flag for phonetic name search
gSearchPhoneticName =
Services.prefs.getComplexValue("mail.addr_book.show_phonetic_fields",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
// Initialize globals, see abCommon.js , InitCommonJS()
abList = document.getElementById("abPopup");
if (abList.getItemAtIndex(0) != (kAllDirectoryRoot + "?"))
abList.insertItemAt(0, gAddressBookBundle.getString("allAddressBooks"),
kAllDirectoryRoot + "?");
if (window.arguments && window.arguments[0])
--- a/mail/base/content/FilterListDialog.js
+++ b/mail/base/content/FilterListDialog.js
@@ -81,28 +81,28 @@ var gStatusFeedback = {
};
var filterEditorQuitObserver = {
observe: function(aSubject, aTopic, aData)
{
// Check whether or not we want to veto the quit request (unless another
// observer already did.
if (aTopic == "quit-application-requested" &&
- (aSubject instanceof Components.interfaces.nsISupportsPRBool) &&
+ (aSubject instanceof Ci.nsISupportsPRBool) &&
!aSubject.data)
aSubject.data = !onFilterClose();
}
}
function onLoad()
{
- gFilterListMsgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
+ gFilterListMsgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
+ .createInstance(Ci.nsIMsgWindow);
gFilterListMsgWindow.domWindow = window;
- gFilterListMsgWindow.rootDocShell.appType = Components.interfaces.nsIDocShell.APP_TYPE_MAIL;
+ gFilterListMsgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
gFilterListMsgWindow.statusFeedback = gStatusFeedback;
gFilterListbox = document.getElementById("filterList");
gEditButton = document.getElementById("editButton");
gDeleteButton = document.getElementById("deleteButton");
gCopyToNewButton = document.getElementById("copyToNewButton");
gTopButton = document.getElementById("reorderTopButton");
gUpButton = document.getElementById("reorderUpButton");
@@ -401,17 +401,17 @@ function calculatePositionAndShowCreateF
if ("refresh" in args && args.refresh) {
// On success: reset the search box if necessary!
resetSearchBox(args.newFilter);
rebuildFilterList();
// Select the new filter, it is at the position of previous selection.
gFilterListbox.selectItem(gFilterListbox.getItemAtIndex(position));
if (currentFilter() != args.newFilter)
- Components.utils.reportError("Filter created at an unexpected position!");
+ Cu.reportError("Filter created at an unexpected position!");
}
}
/**
* Delete selected filters.
* 'Selected' is not to be confused with active (checkbox checked)
*/
function onDeleteFilter()
@@ -521,21 +521,21 @@ function moveFilter(motion) {
if (selectedFilter) {
gCurrentFilterList.removeFilter(selectedFilter);
gCurrentFilterList.insertFilterAt(gCurrentFilterList.filterCount, selectedFilter);
rebuildFilterList();
}
return;
case msgMoveMotion.Up:
relativeStep = -1;
- moveFilterNative = Components.interfaces.nsMsgFilterMotion.up;
+ moveFilterNative = Ci.nsMsgFilterMotion.up;
break;
case msgMoveMotion.Down:
relativeStep = +1;
- moveFilterNative = Components.interfaces.nsMsgFilterMotion.down;
+ moveFilterNative = Ci.nsMsgFilterMotion.down;
break;
}
if (!gSearchBox.value) {
// use legacy move filter code: up, down; only if searchBox is empty
moveCurrentFilter(moveFilterNative);
return;
}
@@ -607,18 +607,18 @@ function runSelectedFilters()
gRunFiltersButton.getAttribute("stoplabel")) {
gFilterListMsgWindow.StopUrls();
return;
}
var folder = gRunFiltersFolder._folder || gRunFiltersFolder.selectedItem._folder;
let filterList = MailServices.filters.getTempFilterList(folder);
- let folders = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let folders = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
folders.appendElement(folder);
// make sure the tmp filter list uses the real filter list log stream
filterList.logStream = gCurrentFilterList.logStream;
filterList.loggingEnabled = gCurrentFilterList.loggingEnabled;
let index = 0;
for (let item of gFilterListbox.selectedItems) {
@@ -845,17 +845,17 @@ function getServerThatCanHaveFilters()
// Check to see if default server can have filters.
if (defaultIncomingServer.canHaveFilters)
return defaultIncomingServer;
// If it cannot, check all accounts to find a server
// that can have filters.
let allServers = MailServices.accounts.allServers;
for (let currentServer of fixIterator(allServers,
- Components.interfaces.nsIMsgIncomingServer))
+ Ci.nsIMsgIncomingServer))
{
if (currentServer.canHaveFilters)
return currentServer;
}
return null;
}
@@ -940,17 +940,17 @@ function getFirstFolder(msgFolder)
// Choose Folder for feeds.
if (msgFolder.server.type == "rss")
return null;
if (msgFolder.server.type != "nntp")
{
// Find Inbox for imap and pop; show Choose Folder if not found or
// Local Folders or any other account type.
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
// If inbox does not exist then return null.
return msgFolder.getFolderWithFlags(nsMsgFolderFlags.Inbox);
}
// For news, this is the account folder.
return msgFolder;
}
catch (ex) {
--- a/mail/base/content/SearchDialog.js
+++ b/mail/base/content/SearchDialog.js
@@ -8,17 +8,17 @@ ChromeUtils.import("resource://gre/modul
var gCurrentFolder;
var gFolderDisplay;
// Although we don't display messages, we have a message display object to
// simplify our code. It's just always disabled.
var gMessageDisplay;
-var nsIMsgWindow = Components.interfaces.nsIMsgWindow;
+var nsIMsgWindow = Ci.nsIMsgWindow;
var gFolderPicker;
var gStatusFeedback;
var gTimelineEnabled = false;
var RDF;
var gSearchBundle;
// Datasource search listener -- made global as it has to be registered
@@ -219,30 +219,30 @@ SearchFolderDisplayWidget.prototype = {
},
};
function searchOnLoad()
{
initializeSearchWidgets();
initializeSearchWindowWidgets();
- messenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ messenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
gSearchBundle = document.getElementById("bundle_search");
gSearchStopButton.setAttribute("label", gSearchBundle.getString("labelForSearchButton"));
gSearchStopButton.setAttribute("accesskey", gSearchBundle.getString("labelForSearchButton.accesskey"));
gMessageDisplay = new NeverVisisbleMessageDisplayWidget();
gFolderDisplay = new SearchFolderDisplayWidget(gMessageDisplay);
gFolderDisplay.messenger = messenger;
gFolderDisplay.msgWindow = msgWindow;
gFolderDisplay.tree = document.getElementById("threadTree");
gFolderDisplay.treeBox = gFolderDisplay.tree.boxObject.QueryInterface(
- Components.interfaces.nsITreeBoxObject);
+ Ci.nsITreeBoxObject);
gFolderDisplay.view.openSearchView();
gFolderDisplay.makeActive();
gFolderDisplay.setColumnStates({
subjectCol: { visible: true },
correspondentCol: { visible: Services.prefs.getBoolPref("mail.threadpane.use_correspondents") },
senderCol: { visible: !Services.prefs.getBoolPref("mail.threadpane.use_correspondents") },
dateCol: { visible: true },
@@ -268,20 +268,20 @@ function searchOnUnload()
}
function initializeSearchWindowWidgets()
{
gFolderPicker = document.getElementById("searchableFolders");
gSearchStopButton = document.getElementById("search-button");
hideMatchAllItem();
- msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(nsIMsgWindow);
+ msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
+ .createInstance(nsIMsgWindow);
msgWindow.domWindow = window;
- msgWindow.rootDocShell.appType = Components.interfaces.nsIDocShell.APP_TYPE_MAIL;
+ msgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
gStatusFeedback = new nsMsgStatusFeedback();
msgWindow.statusFeedback = gStatusFeedback;
// functionality to enable/disable buttons using nsSearchResultsController
// depending of whether items are selected in the search results thread pane.
top.controllers.insertControllerAt(0, nsSearchResultsController);
}
@@ -371,17 +371,17 @@ function getSearchTerms() {
for (let iTerm = 0; iTerm < gSearchTerms.length; iTerm++) {
let termWrapper = gSearchTerms[iTerm].obj;
let realTerm = termCreator.createTerm();
termWrapper.saveTo(realTerm);
// A header search of "" is illegal for IMAP and will cause us to
// explode. You don't want that and I don't want that. So let's check
// if the bloody term is a subject search on a blank string, and if it
// is, let's secretly not add the term. Everyone wins!
- if ((realTerm.attrib != Components.interfaces.nsMsgSearchAttrib.Subject) ||
+ if ((realTerm.attrib != Ci.nsMsgSearchAttrib.Subject) ||
(realTerm.value.str != ""))
searchTerms.push(realTerm);
}
return searchTerms;
}
/**
@@ -401,19 +401,19 @@ function getSearchFolders() {
return searchFolders;
}
function AddSubFolders(folder, outFolders) {
var subFolders = folder.subFolders;
while (subFolders.hasMoreElements()) {
var nextFolder =
- subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
+ subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
- if (!(nextFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual)) {
+ if (!(nextFolder.flags & Ci.nsMsgFolderFlags.Virtual)) {
if (!nextFolder.noSelect)
outFolders.push(nextFolder);
AddSubFolders(nextFolder, outFolders);
}
}
}
@@ -421,19 +421,19 @@ function AddSubFoldersToURI(folder)
{
var returnString = "";
var subFolders = folder.subFolders;
while (subFolders.hasMoreElements())
{
var nextFolder =
- subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
+ subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
- if (!(nextFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual))
+ if (!(nextFolder.flags & Ci.nsMsgFolderFlags.Virtual))
{
if (!nextFolder.noSelect && !nextFolder.isServer)
{
if (returnString.length > 0)
returnString += '|';
returnString += nextFolder.URI;
}
var subFoldersString = AddSubFoldersToURI(nextFolder);
@@ -477,18 +477,18 @@ function GetScopeForFolder(folder)
// whether we have the body and/or junk available or not.
let localType;
try
{
localType = folder.server.localStoreType;
}
catch (e) {} // On error, we'll just assume the default mailbox type
- let hasBody = folder.getFlag(Components.interfaces.nsMsgFolderFlags.Offline);
- let nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
+ let hasBody = folder.getFlag(Ci.nsMsgFolderFlags.Offline);
+ let nsMsgSearchScope = Ci.nsMsgSearchScope;
switch (localType)
{
case "news":
// News has four offline scopes, depending on whether junk and body
// are available.
let hasJunk =
folder.getInheritedStringProperty("dobayes.mailnews@mozilla.org#junk")
== "true";
@@ -505,34 +505,34 @@ function GetScopeForFolder(folder)
// Junk is always enabled for imap, so the offline scope only depends on
// whether the body is available.
// If we are the root folder, use the server property for body rather
// than the folder property.
if (folder.isServer)
{
let imapServer = folder.server
- .QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ .QueryInterface(Ci.nsIImapIncomingServer);
if (imapServer && imapServer.offlineDownload)
hasBody = true;
}
if (!hasBody)
return nsMsgSearchScope.onlineManual;
// fall through to default
default:
return nsMsgSearchScope.offlineMail;
}
}
-var nsMsgViewSortType = Components.interfaces.nsMsgViewSortType;
-var nsMsgViewSortOrder = Components.interfaces.nsMsgViewSortOrder;
-var nsMsgViewFlagsType = Components.interfaces.nsMsgViewFlagsType;
-var nsMsgViewCommandType = Components.interfaces.nsMsgViewCommandType;
+var nsMsgViewSortType = Ci.nsMsgViewSortType;
+var nsMsgViewSortOrder = Ci.nsMsgViewSortOrder;
+var nsMsgViewFlagsType = Ci.nsMsgViewFlagsType;
+var nsMsgViewCommandType = Ci.nsMsgViewCommandType;
function goUpdateSearchItems(commandset)
{
for (var i = 0; i < commandset.childNodes.length; i++)
{
var commandID = commandset.childNodes[i].getAttribute("id");
if (commandID)
{
@@ -561,17 +561,17 @@ function MoveMessageInSearch(destFolder)
// Get the msg folder we're moving messages into.
// If the id (uri) is not set, use file-uri which is set for
// "File Here".
let destUri = destFolder.getAttribute('id');
if (destUri.length == 0)
destUri = destFolder.getAttribute('file-uri');
let destMsgFolder = MailUtils.getFolderForURI(destUri)
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
gFolderDisplay.hintAboutToDeleteMessages();
gFolderDisplay.doCommandWithFolder(nsMsgViewCommandType.moveMessages,
destMsgFolder);
}
function OpenInFolder()
{
--- a/mail/base/content/aboutDialog-appUpdater.js
+++ b/mail/base/content/aboutDialog-appUpdater.js
@@ -10,17 +10,17 @@ ChromeUtils.import("resource://gre/modul
const PREF_APP_UPDATE_CANCELATIONS_OSX = "app.update.cancelations.osx";
const PREF_APP_UPDATE_ELEVATE_NEVER = "app.update.elevate.never";
var gAppUpdater;
function onUnload(aEvent) {
if (gAppUpdater.isChecking)
- gAppUpdater.checker.stopChecking(Components.interfaces.nsIUpdateChecker.CURRENT_CHECK);
+ gAppUpdater.checker.stopChecking(Ci.nsIUpdateChecker.CURRENT_CHECK);
// Safe to call even when there isn't a download in progress.
gAppUpdater.removeDownloadListener();
gAppUpdater = null;
}
function appUpdater()
{
@@ -214,36 +214,36 @@ appUpdater.prototype =
* which is presented after the download has been downloaded.
*/
buttonRestartAfterDownload: function() {
if (!this.isPending && !this.isApplied) {
return;
}
// Notify all windows that an application quit has been requested.
- let cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"].
- createInstance(Components.interfaces.nsISupportsPRBool);
+ let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].
+ createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
// Something aborted the quit process.
if (cancelQuit.data) {
return;
}
- let appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].
- getService(Components.interfaces.nsIAppStartup);
+ let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].
+ getService(Ci.nsIAppStartup);
// If already in safe mode restart in safe mode (bug 327119)
if (Services.appinfo.inSafeMode) {
- appStartup.restartInSafeMode(Components.interfaces.nsIAppStartup.eAttemptQuit);
+ appStartup.restartInSafeMode(Ci.nsIAppStartup.eAttemptQuit);
return;
}
- appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit |
- Components.interfaces.nsIAppStartup.eRestart);
+ appStartup.quit(Ci.nsIAppStartup.eAttemptQuit |
+ Ci.nsIAppStartup.eRestart);
},
/**
* Implements nsIUpdateCheckListener. The methods implemented by
* nsIUpdateCheckListener are in a different scope from nsIIncrementalDownload
* to make it clear which are used by each interface.
*/
updateCheckListener: {
@@ -292,30 +292,30 @@ appUpdater.prototype =
gAppUpdater.selectPanel("noUpdatesFound");
return;
},
/**
* See nsISupports.idl
*/
QueryInterface: function(aIID) {
- if (!aIID.equals(Components.interfaces.nsIUpdateCheckListener) &&
- !aIID.equals(Components.interfaces.nsISupports))
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ if (!aIID.equals(Ci.nsIUpdateCheckListener) &&
+ !aIID.equals(Ci.nsISupports))
+ throw Cr.NS_ERROR_NO_INTERFACE;
return this;
}
},
/**
* Starts the download of an update mar.
*/
startDownload: function() {
if (!this.update)
this.update = this.um.activeUpdate;
- this.update.QueryInterface(Components.interfaces.nsIWritablePropertyBag);
+ this.update.QueryInterface(Ci.nsIWritablePropertyBag);
this.update.setProperty("foregroundDownload", "true");
this.aus.pauseDownload();
let state = this.aus.downloadUpdate(this.update, false);
if (state == "failed") {
this.selectPanel("downloadFailed");
return;
}
@@ -346,32 +346,32 @@ appUpdater.prototype =
onStartRequest: function(aRequest, aContext) {
},
/**
* See nsIRequestObserver.idl
*/
onStopRequest: function(aRequest, aContext, aStatusCode) {
switch (aStatusCode) {
- case Components.results.NS_ERROR_UNEXPECTED:
+ case Cr.NS_ERROR_UNEXPECTED:
if (this.update.selectedPatch.state == "download-failed" &&
(this.update.isCompleteUpdate || this.update.patchCount != 2)) {
// Verification error of complete patch, informational text is held in
// the update object.
this.removeDownloadListener();
this.selectPanel("downloadFailed");
break;
}
// Verification failed for a partial patch, complete patch is now
// downloading so return early and do NOT remove the download listener!
break;
- case Components.results.NS_BINDING_ABORTED:
+ case Cr.NS_BINDING_ABORTED:
// Do not remove UI listener since the user may resume downloading again.
break;
- case Components.results.NS_OK:
+ case Cr.NS_OK:
this.removeDownloadListener();
if (this.backgroundUpdateEnabled) {
this.selectPanel("applying");
let update = this.um.activeUpdate;
let self = this;
Services.obs.addObserver(function selectPanelOnUpdate(aSubject, aTopic, aData) {
// Update the UI when the background updater is finished
let status = aData;
@@ -419,15 +419,15 @@ appUpdater.prototype =
this.downloadStatus.value =
DownloadUtils.getTransferTotal(aProgress, aProgressMax);
},
/**
* See nsISupports.idl
*/
QueryInterface: function(aIID) {
- if (!aIID.equals(Components.interfaces.nsIProgressEventSink) &&
- !aIID.equals(Components.interfaces.nsIRequestObserver) &&
- !aIID.equals(Components.interfaces.nsISupports))
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ if (!aIID.equals(Ci.nsIProgressEventSink) &&
+ !aIID.equals(Ci.nsIRequestObserver) &&
+ !aIID.equals(Ci.nsISupports))
+ throw Cr.NS_ERROR_NO_INTERFACE;
return this;
}
};
--- a/mail/base/content/aboutDialog.js
+++ b/mail/base/content/aboutDialog.js
@@ -20,24 +20,24 @@ function init(aEvent)
var distroIdField = document.getElementById("distributionId");
distroIdField.value = distroId + " - " + distroVersion;
distroIdField.style.display = "block";
try {
// This is in its own try catch due to bug 895473 and bug 900925.
var distroAbout = Services.prefs.getComplexValue("distribution.about",
- Components.interfaces.nsISupportsString);
+ Ci.nsISupportsString);
var distroField = document.getElementById("distribution");
distroField.value = distroAbout;
distroField.style.display = "block";
}
catch (ex) {
// Pref is unset
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
}
}
catch (e) {
// Pref is unset
}
// XXX FIXME
@@ -99,14 +99,14 @@ function openAboutTab(url)
{ tabType: "contentTab",
tabParams: {contentPage: url, clickHandler: "specialTabs.aboutClickHandler(event);"} });
}
function openUILink(url, event)
{
if (!event.button) {
let m = ("messenger" in window) ? messenger :
- Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
m.launchExternalURL(url);
event.preventDefault();
}
}
--- a/mail/base/content/browserRequest.js
+++ b/mail/base/content/browserRequest.js
@@ -1,27 +1,27 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
-var wpl = Components.interfaces.nsIWebProgressListener;
+var wpl = Ci.nsIWebProgressListener;
var reporterListener = {
_isBusy: false,
get securityButton() {
delete this.securityButton;
return this.securityButton = document.getElementById("security-button");
},
QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIWebProgressListener) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
onStateChange: function(/*in nsIWebProgress*/ aWebProgress,
/*in nsIRequest*/ aRequest,
/*in unsigned long*/ aStateFlags,
/*in nsresult*/ aStatus) {
},
@@ -98,16 +98,16 @@ function loadRequestedUrl()
let request = window.arguments[0].wrappedJSObject;
document.getElementById("headerMessage").textContent = request.promptText;
let account = request.account;
if (request.iconURI != "")
document.getElementById("headerImage").src = request.iconURI;
var browser = document.getElementById("requestFrame");
browser.addProgressListener(reporterListener,
- Components.interfaces.nsIWebProgress.NOTIFY_ALL);
+ Ci.nsIWebProgress.NOTIFY_ALL);
var url = request.url;
if (url != "") {
browser.setAttribute("src", url);
document.getElementById("headerMessage").textContent = url;
}
request.loaded(window, browser.webProgress);
}
--- a/mail/base/content/commandglue.js
+++ b/mail/base/content/commandglue.js
@@ -120,23 +120,23 @@ function UpdateStatusMessageCounts(folde
totalElement.hidden = false;
}
}
var gQuotaUICache;
function UpdateStatusQuota(folder)
{
if (!(folder && // no folder selected
- folder instanceof Components.interfaces.nsIMsgImapMailFolder)) // POP etc.
+ folder instanceof Ci.nsIMsgImapMailFolder)) // POP etc.
{
if (typeof(gQuotaUICache) == "object") // ever shown quota
gQuotaUICache.panel.hidden = true;
return;
}
- folder = folder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ folder = folder.QueryInterface(Ci.nsIMsgImapMailFolder);
// get element references and prefs
if (typeof(gQuotaUICache) != "object")
{
gQuotaUICache = new Object();
gQuotaUICache.meter = document.getElementById("quotaMeter");
gQuotaUICache.panel = document.getElementById("quotaPanel");
gQuotaUICache.label = document.getElementById("quotaLabel");
@@ -267,22 +267,22 @@ function ConvertSortTypeToColumnID(sortK
default:
dump("unsupported sort key: " + sortKey + "\n");
columnID = "dateCol";
break;
}
return columnID;
}
-var nsMsgViewSortType = Components.interfaces.nsMsgViewSortType;
-var nsMsgViewSortOrder = Components.interfaces.nsMsgViewSortOrder;
-var nsMsgViewFlagsType = Components.interfaces.nsMsgViewFlagsType;
-var nsMsgViewCommandType = Components.interfaces.nsMsgViewCommandType;
-var nsMsgViewType = Components.interfaces.nsMsgViewType;
-var nsMsgNavigationType = Components.interfaces.nsMsgNavigationType;
+var nsMsgViewSortType = Ci.nsMsgViewSortType;
+var nsMsgViewSortOrder = Ci.nsMsgViewSortOrder;
+var nsMsgViewFlagsType = Ci.nsMsgViewFlagsType;
+var nsMsgViewCommandType = Ci.nsMsgViewCommandType;
+var nsMsgViewType = Ci.nsMsgViewType;
+var nsMsgNavigationType = Ci.nsMsgNavigationType;
var gDBView = null;
var gCurViewFlags;
var gCurSortType;
function ChangeMessagePaneVisibility(now_hidden)
{
--- a/mail/base/content/contentAreaClick.js
+++ b/mail/base/content/contentAreaClick.js
@@ -140,19 +140,19 @@ function contentAreaClick(aEvent)
if (!href || aEvent.button == 2)
return true;
// We want all about, http and https links in the message pane to be loaded
// externally in a browser, therefore we need to detect that here and redirect
// as necessary.
let uri = makeURI(href);
- if (Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
- .isExposedProtocol(uri.scheme) &&
+ if (Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .isExposedProtocol(uri.scheme) &&
!uri.schemeIs("http") && !uri.schemeIs("https"))
return true;
// Now we're here, we know this should be loaded in an external browser, so
// prevent the default action so we don't try and load it here.
aEvent.preventDefault();
// Let the phishing detector check the link.
@@ -167,35 +167,35 @@ function contentAreaClick(aEvent)
* Forces a url to open in an external application according to the protocol
* service settings.
*
* @param url A url string or an nsIURI containing the url to open.
*/
function openLinkExternally(url)
{
let uri = url;
- if (!(uri instanceof Components.interfaces.nsIURI))
+ if (!(uri instanceof Ci.nsIURI))
uri = Services.io.newURI(url);
// This can fail if there is a problem with the places database.
try {
PlacesUtils.asyncHistory.updatePlaces({
uri: uri,
visits: [{
visitDate: Date.now() * 1000,
- transitionType: Components.interfaces.nsINavHistoryService.TRANSITION_LINK
+ transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
}]
});
} catch (ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
- .loadURI(uri);
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(uri);
}
/**
* Compatibility to Firefox, used for example by devtools to open links. Defer
* this to the external browser for now, since in most cases this is meant to
* open an actionable tab.
*/
function openUILinkIn(url, where, options) {
--- a/mail/base/content/editContactOverlay.js
+++ b/mail/base/content/editContactOverlay.js
@@ -137,22 +137,22 @@ var editContactInlineUI = {
// Is this card contained within mailing lists?
let inMailList = false;
if (this._cardDetails.book.supportsMailingLists) {
// We only have to look in one book here, because cards currently have
// to be in the address book they belong to.
let mailingLists = this._cardDetails.book.childNodes;
while (mailingLists.hasMoreElements() && !inMailList) {
let list = mailingLists.getNext();
- if (!(list instanceof Components.interfaces.nsIAbDirectory) ||
+ if (!(list instanceof Ci.nsIAbDirectory) ||
!list.isMailList)
continue;
for (let card of fixIterator(list.addressLists)) {
- if (card instanceof Components.interfaces.nsIAbCard &&
+ if (card instanceof Ci.nsIAbCard &&
card.primaryEmail == this._cardDetails.card.primaryEmail) {
inMailList = true;
break;
}
}
}
}
@@ -185,18 +185,18 @@ var editContactInlineUI = {
this.panel.hidePopup();
var bundle = document.getElementById("bundle_editContact");
if (!Services.prompt.confirm(window,
bundle.getString("deleteContactTitle"),
bundle.getString("deleteContactMessage")))
return; /* XXX would be nice to bring the popup back up here */
- let cardArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let cardArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
cardArray.appendElement(this._cardDetails.card);
MailServices.ab.getDirectory(this._cardDetails.book.URI).deleteCards(cardArray);
},
saveChanges: function() {
// If we're a popup dialog, just hide the popup and return
if (!this._writeable) {
@@ -225,17 +225,17 @@ var editContactInlineUI = {
}
else {
// We changed address books for the card.
// Add it to the chosen address book...
this._cardDetails.book.addCard(this._cardDetails.card);
// ...and delete it from the old place.
- let cardArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let cardArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
cardArray.appendElement(this._cardDetails.card);
originalBook.deleteCards(cardArray);
}
this.panel.hidePopup();
}
}
--- a/mail/base/content/folderDisplay.js
+++ b/mail/base/content/folderDisplay.js
@@ -5,18 +5,18 @@
ChromeUtils.import("resource:///modules/dbViewWrapper.js");
ChromeUtils.import("resource:///modules/jsTreeSelection.js");
ChromeUtils.import("resource:///modules/MailUtils.js");
ChromeUtils.import("resource://gre/modules/Services.jsm");
var gFolderDisplay = null;
var gMessageDisplay = null;
-var nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
-var nsMsgMessageFlags = Components.interfaces.nsMsgMessageFlags;
+var nsMsgFolderFlags = Ci.nsMsgFolderFlags;
+var nsMsgMessageFlags = Ci.nsMsgMessageFlags;
/**
* Maintains a list of listeners for all FolderDisplayWidget instances in this
* window. The assumption is that because of our multiplexed tab
* implementation all consumers are effectively going to care about all such
* tabs.
*
* We are not just a global list so that we can add brains about efficiently
@@ -64,18 +64,18 @@ var FolderDisplayListenerManager = {
*/
_fireListeners: function FDBLM__fireListeners(aEventName, aArgs) {
for (let listener of this._listeners) {
if (aEventName in listener) {
try {
listener[aEventName].apply(listener, aArgs);
}
catch(e) {
- Components.utils.reportError(aEventName + " event listener FAILED; " +
- e + " at: " + e.stack);
+ Cu.reportError(aEventName + " event listener FAILED; " +
+ e + " at: " + e.stack);
}
}
}
},
};
/**
* Abstraction for a widget that (roughly speaking) displays the contents of
@@ -208,17 +208,17 @@ FolderDisplayWidget.prototype = {
* @return true if the selection should be summarized for this folder. This
* is based on the mail.operate_on_msgs_in_collapsed_threads pref and
* if we are in a newsgroup folder. XXX When bug 478167 is fixed, this
* should be limited to being disabled for newsgroups that are not stored
* offline.
*/
get summarizeSelectionInFolder() {
return Services.prefs.getBoolPref("mail.operate_on_msgs_in_collapsed_threads") &&
- !(this.displayedFolder instanceof Components.interfaces.nsIMsgNewsFolder);
+ !(this.displayedFolder instanceof Ci.nsIMsgNewsFolder);
},
/**
* @return the nsITreeSelection object for our tree view. This exists for
* the benefit of message tabs that haven't been switched to yet.
* We provide a fake tree selection in those cases.
* @protected
*/
@@ -359,20 +359,20 @@ FolderDisplayWidget.prototype = {
* views. Not all views respect viewFlags, ie single folder non-virtual.
*/
restoreThreadState: function() {
if (!this._active || !this.tree || !this.view.dbView.viewFolder)
return;
if (this.view._threadExpandAll &&
!(this.view.dbView.viewFlags & nsMsgViewFlagsType.kExpandAll))
- this.view.dbView.doCommand(Components.interfaces.nsMsgViewCommandType.expandAll);
+ this.view.dbView.doCommand(Ci.nsMsgViewCommandType.expandAll);
if (!this.view._threadExpandAll &&
this.view.dbView.viewFlags & nsMsgViewFlagsType.kExpandAll)
- this.view.dbView.doCommand(Components.interfaces.nsMsgViewCommandType.collapseAll);
+ this.view.dbView.doCommand(Ci.nsMsgViewCommandType.collapseAll);
},
//@}
/**
* @name Columns
* @protected Folder Display
*/
//@{
@@ -521,17 +521,17 @@ FolderDisplayWidget.prototype = {
if (!this.view.displayedFolder || !this.view.displayedFolder.msgDatabase)
return;
let msgDatabase = this.view.displayedFolder.msgDatabase;
let dbFolderInfo = msgDatabase.dBFolderInfo;
dbFolderInfo.setCharProperty(this.PERSISTED_COLUMN_PROPERTY_NAME,
JSON.stringify(aState));
- msgDatabase.Commit(Components.interfaces.nsMsgDBCommitType.kLargeCommit);
+ msgDatabase.Commit(Ci.nsMsgDBCommitType.kLargeCommit);
},
/**
* Let us know that the state of the columns has changed. This is either due
* to a re-ordering or hidden-ness being toggled.
*
* This method should only be called on (the active) gFolderDisplay.
*/
@@ -542,17 +542,17 @@ FolderDisplayWidget.prototype = {
this._persistColumnStates(this.getColumnStates());
},
/**
* Either inherit the column state of another folder or use heuristics to
* figure out the best column state for the current folder.
*/
_getDefaultColumnsForCurrentFolder: function(aDoNotInherit) {
- const InboxFlag = Components.interfaces.nsMsgFolderFlags.Inbox;
+ const InboxFlag = Ci.nsMsgFolderFlags.Inbox;
// If the view is synthetic, try asking it for its default columns. If it
// fails, just return nothing, since most synthetic views don't care about
// columns anyway.
if (this.view.isSynthetic) {
if ("getDefaultSetting" in this.view._syntheticView)
return this.view._syntheticView.getDefaultSetting("columns");
return {};
@@ -600,17 +600,17 @@ FolderDisplayWidget.prototype = {
if (colId in this.COLUMN_DEFAULT_TESTERS) {
// This is potentially going to be used by extensions; avoid them
// killing us.
try {
shouldShowColumn = this.COLUMN_DEFAULT_TESTERS[colId](this.view);
}
catch (ex) {
shouldShowColumn = false;
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
}
state[colId] = {visible: shouldShowColumn};
}
return state;
},
/**
@@ -783,17 +783,17 @@ FolderDisplayWidget.prototype = {
*
* @param aFolder The nsIMsgDBFolder to display.
*/
show: function FolderDisplayWidget_show(aFolder) {
if (aFolder == null) {
this._nonViewFolder = null;
this.view.close();
}
- else if (aFolder instanceof Components.interfaces.nsIMsgFolder) {
+ else if (aFolder instanceof Ci.nsIMsgFolder) {
if (aFolder.isServer) {
this._nonViewFolder = aFolder;
this._showServer();
this.view.close();
// A server is fully loaded immediately, for now. (When we have the
// account summary, we might want to change this to wait for the page
// load to complete.)
this._allMessagesLoaded = true;
@@ -1739,17 +1739,17 @@ FolderDisplayWidget.prototype = {
*/
_showAccountCentral: function FolderDisplayWidget__showAccountCentral() {
var accountBox = document.getElementById("accountCentralBox");
document.getElementById("displayDeck").selectedPanel = accountBox;
var prefName = "mailnews.account_central_page.url";
// oh yeah, 'pref' is a global all right.
var acctCentralPage =
Services.prefs.getComplexValue(prefName,
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
window.frames["accountCentralPane"].location.href = acctCentralPage;
},
/**
* Call this when the tab using us is being hidden.
*/
makeInactive: function FolderDisplayWidget_makeInactive() {
// - things to do before we mark ourselves inactive (because they depend on
@@ -2155,17 +2155,17 @@ FolderDisplayWidget.prototype = {
if (folderIdentity)
return folderIdentity.archiveEnabled;
if (this.displayedFolder.server) {
let serverIdentities = MailServices.accounts.getIdentitiesForServer(
this.displayedFolder.server
);
- const nsIMsgIdentity = Components.interfaces.nsIMsgIdentity;
+ const nsIMsgIdentity = Ci.nsIMsgIdentity;
let allEnabled = undefined;
for (let identity of fixIterator(serverIdentities, nsIMsgIdentity)) {
if (allEnabled === undefined) {
allEnabled = identity.archiveEnabled;
}
else if (identity.archiveEnabled != allEnabled) {
allEnabled = undefined;
break;
@@ -2467,17 +2467,17 @@ FolderDisplayWidget.prototype = {
topPadding--;
else
bottomPadding--;
}
} else {
// Something's gone wrong elsewhere, and we likely have bigger problems.
topPadding = 0;
bottomPadding = 0;
- Components.utils.reportError(
+ Cu.reportError(
"Unable to get height of folder pane (treeBox is null)");
}
return [topPadding, bottomPadding];
},
/**
* Ensure the given view index is visible, optionally with some padding.
@@ -2700,20 +2700,20 @@ FakeTreeBoxObject.prototype = {
},
setProperty : function FakeTreeBoxObject_setProperty(propertyName, value) {
return this.domNode.boxObject.setProperty(propertyName, value);
},
removeProperty : function FakeTreeBoxObject_removeProperty(propertyName) {
return this.domNode.boxObject.removeProperty(propertyName);
},
QueryInterface: function FakeTreeBoxObject_QueryInterface(aIID) {
- if (!aIID.equals(Components.interfaces.nsISupports) &&
- !aIID.equals(Components.interfaces.nsIBoxObject) &&
- !aIID.equals(Components.interfaces.nsITreeBoxObject))
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ if (!aIID.equals(Ci.nsISupports) &&
+ !aIID.equals(Ci.nsIBoxObject) &&
+ !aIID.equals(Ci.nsITreeBoxObject))
+ throw Cr.NS_ERROR_NO_INTERFACE;
return this;
}
};
/*
* Provide attribute and function implementations that complain very loudly if
* they are used. Now, XPConnect will return an error to callers if we don't
* implement part of the interface signature, but this is unlikely to provide
* the visibility we desire. In fact, since it is a simple nsresult error,
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -15,17 +15,17 @@ ChromeUtils.import("resource:///modules/
ChromeUtils.import("resource:///modules/FeedUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
if (typeof FeedMessageHandler != "object")
Services.scriptloader.loadSubScript("chrome://messenger-newsblog/content/newsblogOverlay.js");
var kDefaultMode = "all";
-var nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+var nsMsgFolderFlags = Ci.nsMsgFolderFlags;
/**
* This file contains the controls and functions for the folder pane.
* The following definitions will be useful to know:
*
* gFolderTreeView - the controller for the folder tree.
* ftvItem - folder tree view item, representing a row in the tree
* mode - folder view type, e.g., all folders, favorite folders, MRU...
@@ -156,17 +156,17 @@ var gFolderTreeView = {
if (aJSONFile) {
// Parse our persistent-open-state json file
let data = IOUtils.loadFileToString(aJSONFile);
if (data) {
try {
this._persistOpenMap = JSON.parse(data);
} catch (x) {
- Components.utils.reportError(
+ Cu.reportError(
gFolderTreeView.messengerBundle
.getFormattedString("failedToReadFile", [aJSONFile, x]));
}
}
}
// Load our data
this._updateCompactState(this.mode);
@@ -1118,25 +1118,25 @@ var gFolderTreeView = {
if (this._treeElement.getAttribute("simplelist") == "true")
return;
// if this was a server that was expanded, let it update its counts
let folder = this._rowMap[aIndex]._folder;
if (aExpandServer) {
if (folder.isServer)
folder.server.performExpand(msgWindow);
- else if (folder instanceof Components.interfaces.nsIMsgImapMailFolder)
+ else if (folder instanceof Ci.nsIMsgImapMailFolder)
folder.performExpand(msgWindow);
}
}
},
_subFoldersWithStringProperty: function ftv_subFoldersWithStringProperty(folder, folders, aFolderName, deep)
{
- for (let child of fixIterator(folder.subFolders, Components.interfaces.nsIMsgFolder)) {
+ for (let child of fixIterator(folder.subFolders, Ci.nsIMsgFolder)) {
// if the folder selection is based on a string propery, use that
if (aFolderName == getSmartFolderName(child)) {
folders.push(child);
// Add sub-folders if requested.
if (deep)
this.addSubFolders(child, folders);
}
else
@@ -1157,17 +1157,17 @@ var gFolderTreeView = {
_allFoldersWithFlag: function ftv_getAllFolders(accounts, aFolderFlag, deep)
{
let folders = [];
for (let acct of accounts) {
let foldersWithFlag = acct.incomingServer.rootFolder.getFoldersWithFlags(aFolderFlag);
if (foldersWithFlag.length > 0) {
for (let folderWithFlag of fixIterator(foldersWithFlag,
- Components.interfaces.nsIMsgFolder)) {
+ Ci.nsIMsgFolder)) {
folders.push(folderWithFlag);
// Add sub-folders of Sent and Archive to the result.
if (deep && (aFolderFlag & (nsMsgFolderFlags.SentMail | nsMsgFolderFlags.Archive)))
this.addSubFolders(folderWithFlag, folders);
}
}
}
return folders;
@@ -1272,17 +1272,17 @@ var gFolderTreeView = {
sortFolderItems(smartFolderItem._children);
return smartFolderItem;
},
_createVFFolder: function ftv_createVFFolder(newName, parentFolder,
searchFolderURIs, folderFlag)
{
let newFolder;
try {
- if (parentFolder instanceof(Components.interfaces.nsIMsgLocalMailFolder))
+ if (parentFolder instanceof(Ci.nsIMsgLocalMailFolder))
newFolder = parentFolder.createLocalSubfolder(newName);
else
newFolder = parentFolder.addSubfolder(newName);
newFolder.setFlag(nsMsgFolderFlags.Virtual);
// provide a way to make the top level folder just a container, not
// a search folder
let type = this._modes["smart"].getSmartFolderTypeByName(newName);
if (type[3]) { // isSearch
@@ -1473,17 +1473,17 @@ var gFolderTreeView = {
},
_sortedAccounts: function ftv_getSortedAccounts() {
let accounts = allAccountsSorted(true);
// Don't show deferred pop accounts.
accounts = accounts.filter(function isNotDeferred(a) {
let server = a.incomingServer;
- return !(server instanceof Components.interfaces.nsIPop3IncomingServer &&
+ return !(server instanceof Ci.nsIPop3IncomingServer &&
server.deferredToAccount);
});
return accounts;
},
/*
* Session cache keyed by folder url, for properties intended to survive
@@ -1660,18 +1660,18 @@ var gFolderTreeView = {
}
return favRootFolders;
},
handleChangedIntProperty: function(aItem, aProperty, aOld, aNew) {
// We want to rebuild if the favorite status of a folder changed.
if (aProperty == "FolderFlag" &&
- ((aOld & Components.interfaces.nsMsgFolderFlags.Favorite) !=
- (aNew & Components.interfaces.nsMsgFolderFlags.Favorite))) {
+ ((aOld & Ci.nsMsgFolderFlags.Favorite) !=
+ (aNew & Ci.nsMsgFolderFlags.Favorite))) {
gFolderTreeView._rebuild();
return true;
}
return false;
}
},
/**
@@ -1715,18 +1715,18 @@ var gFolderTreeView = {
getParentOfFolder: function(aFolder) {
// This is a flat view, so no folders have parents.
return null;
},
handleChangedIntProperty: function(aItem, aProperty, aOld, aNew) {
// We want to rebuild if the favorite status of a folder changed.
if (aProperty == "FolderFlag" &&
- ((aOld & Components.interfaces.nsMsgFolderFlags.Favorite) !=
- (aNew & Components.interfaces.nsMsgFolderFlags.Favorite))) {
+ ((aOld & Ci.nsMsgFolderFlags.Favorite) !=
+ (aNew & Ci.nsMsgFolderFlags.Favorite))) {
gFolderTreeView._rebuild();
return true;
}
return false;
}
},
recent_compact: {
@@ -2047,17 +2047,17 @@ var gFolderTreeView = {
/**
* This is a recursive function to add all subfolders to the array. It
* assumes that the passed in folder itself has already been added.
*
* @param aFolder the folder whose subfolders should be added
* @param folders the array to add the folders to.
*/
addSubFolders : function ftv_addSubFolders (folder, folders) {
- for (let f of fixIterator(folder.subFolders, Components.interfaces.nsIMsgFolder)) {
+ for (let f of fixIterator(folder.subFolders, Ci.nsIMsgFolder)) {
folders.push(f);
this.addSubFolders(f, folders);
}
},
/**
* This updates the rowmap and invalidates the right row(s) in the tree
*/
@@ -2132,28 +2132,28 @@ var gFolderTreeView = {
this._tree.rowCountChanged(newChildIndex, 1);
}
},
/**
* This is our implementation of nsIMsgFolderListener to watch for changes
*/
OnItemAdded: function ftl_add(aParentItem, aItem) {
// Ignore this item if it's not a folder, or we knew about it.
- if (!(aItem instanceof Components.interfaces.nsIMsgFolder) ||
+ if (!(aItem instanceof Ci.nsIMsgFolder) ||
this.getIndexOfFolder(aItem) != null)
return;
// if no parent, this is an account, so let's rebuild.
if (!aParentItem) {
if (!aItem.server.hidden) // ignore hidden server items
this._rebuild();
return;
}
this._modes[this._mode].onFolderAdded(
- aParentItem.QueryInterface(Components.interfaces.nsIMsgFolder), aItem);
+ aParentItem.QueryInterface(Ci.nsIMsgFolder), aItem);
},
addFolder: function ftl_add_folder(aParentItem, aItem)
{
// This intentionally adds any new folder even if it would not pass the
// _filterFunction. The idea is that the user can add new folders even
// in modes like "unread" or "favorite" and could wonder why they
// are not appearing (forgetting they do not meet the criteria of the view).
// The folders will be hidden properly next time the view is rebuilt.
@@ -2192,17 +2192,17 @@ var gFolderTreeView = {
this._toggleRow(parentIndex, false);
return;
}
}
this._addChildToView(parent, parentIndex, newChild);
},
OnItemRemoved: function ftl_remove(aRDFParentItem, aItem) {
- if (!(aItem instanceof Components.interfaces.nsIMsgFolder))
+ if (!(aItem instanceof Ci.nsIMsgFolder))
return;
this._persistItemClosed(aItem.URI);
let index = this.getIndexOfFolder(aItem);
if (index == null)
return;
// forget our parent's children; they'll get rebuilt
@@ -2221,17 +2221,17 @@ var gFolderTreeView = {
},
OnItemPropertyChanged: function(aItem, aProperty, aOld, aNew) {},
OnItemIntPropertyChanged: function(aItem, aProperty, aOld, aNew) {
// First try mode specific handling of the changed property.
if (this._modes[this.mode].handleChangedIntProperty(aItem, aProperty, aOld, aNew))
return;
- if (aItem instanceof Components.interfaces.nsIMsgFolder) {
+ if (aItem instanceof Ci.nsIMsgFolder) {
let index = this.getIndexOfFolder(aItem);
let folder = aItem;
let folderTreeMode = this._modes[this._mode];
// look for first visible ancestor
while (index == null) {
folder = folderTreeMode.getParentOfFolder(folder);
if (!folder)
break;
@@ -2475,17 +2475,17 @@ var gFolderTreeController = {
let rootMsgFolder = folder.server.rootMsgFolder;
if (rootMsgFolder.canCreateSubfolders)
folder = rootMsgFolder;
else // just use the default account
folder = GetDefaultAccountRootFolder();
}
let dualUseFolders = true;
- if (folder.server instanceof Components.interfaces.nsIImapIncomingServer)
+ if (folder.server instanceof Ci.nsIImapIncomingServer)
dualUseFolders = folder.server.dualUseFolders;
function newFolderCallback(aName, aFolder) {
// createSubfolder can throw an exception, causing the newFolder dialog
// to not close and wait for another input.
// TODO: Rewrite this logic and also move the opening of alert dialogs from
// nsMsgLocalMailFolder::CreateSubfolderInternal to here (bug 831190#c16).
if (aName)
@@ -2583,17 +2583,17 @@ var gFolderTreeController = {
*/
renameFolder: function ftc_rename(aFolder) {
let folder = aFolder || gFolderTreeView.getSelectedFolders()[0];
//xxx no need for uri now
let controller = this;
function renameCallback(aName, aUri) {
if (aUri != folder.URI)
- Components.utils.reportError("got back a different folder to rename!");
+ Cu.reportError("got back a different folder to rename!");
controller._tree.view.selection.clearSelection();
// Actually do the rename
folder.rename(aName, msgWindow);
}
window.openDialog("chrome://messenger/content/renameFolderDialog.xul",
"",
@@ -2984,17 +2984,17 @@ var gFolderStatsHelpers = {
* @param aFolder The nsIMsgFolder to analyze.
*/
getSubfoldersSize: function(aFolder) {
let folderSize = 0;
if (aFolder.hasSubFolders) {
let subFolders = aFolder.subFolders;
while (subFolders.hasMoreElements()) {
let subFolder = subFolders.getNext()
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
let subSize = this.getFolderSize(subFolder);
let subSubSize = this.getSubfoldersSize(subFolder);
if (subSize == this.kUnknownSize || subSubSize == this.kUnknownSize)
return subSize;
folderSize += subSize + subSubSize;
}
}
--- a/mail/base/content/macMessengerOverlay.js
+++ b/mail/base/content/macMessengerOverlay.js
@@ -34,17 +34,17 @@ function loadListener(event) {
/**
* When the Preferences window is opened/closed, this observer will be called.
* This is done so subdialog opens as a child of it.
*/
function PrefWindowObserver() {
this.observe = function(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- let win = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
+ let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
win.addEventListener("load", loadListener, {capture: false, once: true});
}
Services.ww.unregisterNotification(this);
};
}
/**
* Show the Dock Options sub-dialog hanging from the Preferences window.
@@ -68,27 +68,27 @@ function openDockOptions()
/**
* Open a new window for writing a new message
*/
function writeNewMessageDock()
{
// Default identity will be used as sender for the new message.
MailServices.compose.OpenComposeWindow(null, null, null,
- Components.interfaces.nsIMsgCompType.New,
- Components.interfaces.nsIMsgCompFormat.Default, null, null);
+ Ci.nsIMsgCompType.New,
+ Ci.nsIMsgCompFormat.Default, null, null);
}
/**
* Open the address book window
*/
function openAddressBookDock()
{
let win = Services.wm.getMostRecentWindow("mail:addressbook");
if (win) {
win.focus();
} else {
- let ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].
- getService(Components.interfaces.nsIWindowWatcher);
+ let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
+ getService(Ci.nsIWindowWatcher);
ww.openWindow(null, "chrome://messenger/content/addressbook/addressbook.xul", null,
"chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar", null);
}
}
--- a/mail/base/content/mail-offline.js
+++ b/mail/base/content/mail-offline.js
@@ -8,18 +8,18 @@ ChromeUtils.import("resource://gre/modul
var MailOfflineMgr = {
offlineManager: null,
offlineBundle: null,
init: function()
{
Services.obs.addObserver(this, "network:offline-status-changed");
- this.offlineManager = Components.classes["@mozilla.org/messenger/offline-manager;1"]
- .getService(Components.interfaces.nsIMsgOfflineManager);
+ this.offlineManager = Cc["@mozilla.org/messenger/offline-manager;1"]
+ .getService(Ci.nsIMsgOfflineManager);
this.offlineBundle = document.getElementById("bundle_offlinePrompts");
// initialize our offline state UI
this.updateOfflineUI(!this.isOnline());
},
uninit: function()
{
@@ -69,19 +69,19 @@ var MailOfflineMgr = {
this.mailOfflineStateChanged(aState == "offline");
},
/**
* @return true if there are unsent messages
*/
haveUnsentMessages: function()
{
- return Components.classes["@mozilla.org/messengercompose/sendlater;1"]
- .getService(Components.interfaces.nsIMsgSendLater)
- .hasUnsentMessages();
+ return Cc["@mozilla.org/messengercompose/sendlater;1"]
+ .getService(Ci.nsIMsgSendLater)
+ .hasUnsentMessages();
},
/**
* open the offline panel in the account manager for the currently loaded
* account.
*/
openOfflineAccountSettings: function()
{
--- a/mail/base/content/mail3PaneWindowCommands.js
+++ b/mail/base/content/mail3PaneWindowCommands.js
@@ -526,17 +526,17 @@ var DefaultController =
return folder && folder.server.canEmptyTrashOnExit ?
IsMailFolderSelected() : false;
}
case "button_compact":
{
let folders = gFolderTreeView.getSelectedFolders();
let canCompact = function canCompact(folder) {
return !folder.isServer &&
- !(folder.flags & Components.interfaces.nsMsgFolderFlags.Virtual) &&
+ !(folder.flags & Ci.nsMsgFolderFlags.Virtual) &&
(folder.server.type != "imap" || folder.server.canCompactFoldersOnServer) &&
folder.isCommandEnabled("button_compact");
}
return folders && folders.every(canCompact);
}
case "cmd_compactFolder":
{
let folders = gFolderTreeView.getSelectedFolders();
@@ -677,17 +677,17 @@ var DefaultController =
// selection incorrect.
if (!gRightMouseButtonSavedSelection)
gFolderDisplay.hintAboutToDeleteMessages();
gFolderDisplay.doCommand(nsMsgViewCommandType.deleteMsg);
UpdateDeleteToolbarButton();
break;
case "cmd_cancel":
let message = gFolderDisplay.selectedMessage;
- message.folder.QueryInterface(Components.interfaces.nsIMsgNewsFolder)
+ message.folder.QueryInterface(Ci.nsIMsgNewsFolder)
.cancelMessage(message, msgWindow);
break;
case "button_shiftDelete":
case "cmd_shiftDelete":
MarkSelectedMessagesRead(true);
gFolderDisplay.hintAboutToDeleteMessages();
gFolderDisplay.doCommand(nsMsgViewCommandType.deleteNoTrash);
UpdateDeleteToolbarButton();
@@ -1185,18 +1185,18 @@ function UnloadCommandUpdateHandlers()
function IsSendUnsentMsgsEnabled(unsentMsgsFolder)
{
// If no account has been configured, there are no messages for sending.
if (MailServices.accounts.accounts.length == 0)
return false;
var msgSendlater =
- Components.classes["@mozilla.org/messengercompose/sendlater;1"]
- .getService(Components.interfaces.nsIMsgSendLater);
+ Cc["@mozilla.org/messengercompose/sendlater;1"]
+ .getService(Ci.nsIMsgSendLater);
// If we're currently sending unsent msgs, disable this cmd.
if (msgSendlater.sendingMessages)
return false;
if (unsentMsgsFolder) {
// If unsentMsgsFolder is non-null, it is the "Unsent Messages" folder.
// We're here because we've done a right click on the "Unsent Messages"
@@ -1222,17 +1222,17 @@ function IsSendUnsentMsgsEnabled(unsentM
* Determine whether there exists any server for which to show the Subscribe dialog.
*/
function IsSubscribeEnabled()
{
// If there are any IMAP or News servers, we can show the dialog any time and
// it will properly show those.
let servers = MailServices.accounts.allServers;
for (let server of fixIterator(servers,
- Components.interfaces.nsIMsgIncomingServer)) {
+ Ci.nsIMsgIncomingServer)) {
if (server.type == "imap" || server.type == "nntp")
return true;
}
// RSS accounts use a separate Subscribe dialog that we can only show when
// such an account is selected.
let preselectedFolder = GetFirstSelectedMsgFolder();
if (preselectedFolder && preselectedFolder.server.type == "rss")
@@ -1370,17 +1370,17 @@ function CanRenameDeleteJunkMail(aFolder
// Go through junk mail settings for all servers and see if the folder is set/used by anyone.
try
{
var allServers = accountManager.allServers;
for (var i = 0; i < allServers.length; i++)
{
- var currentServer = allServers.queryElementAt(i, Components.interfaces.nsIMsgIncomingServer);
+ var currentServer = allServers.queryElementAt(i, Ci.nsIMsgIncomingServer);
var settings = currentServer.spamSettings;
// If junk mail control or move junk mail to folder option is disabled then
// allow the folder to be removed/renamed since the folder is not used in this case.
if (!settings.level || !settings.moveOnSpam)
continue;
if (settings.spamFolderURI == aFolderUri)
return false;
}
--- a/mail/base/content/mailCommands.js
+++ b/mail/base/content/mailCommands.js
@@ -25,17 +25,17 @@ function getBestIdentity(identities, opt
if (identityCount > 1 && optionalHint) {
// Normalize case on the optional hint to improve our chances of
// finding a match.
optionalHint = optionalHint.toLowerCase();
let hints = optionalHint.toLowerCase().split(",");
for (let i = 0 ; i < hints.length; i++) {
for (let identity of fixIterator(identities,
- Components.interfaces.nsIMsgIdentity)) {
+ Ci.nsIMsgIdentity)) {
if (!identity.email)
continue;
if (hints[i].trim() == identity.email.toLowerCase() ||
hints[i].includes("<" + identity.email.toLowerCase() + ">"))
return identity;
}
}
}
@@ -45,17 +45,17 @@ function getBestIdentity(identities, opt
let defaultAccount = null;
try {
defaultAccount = accountManager.defaultAccount;
} catch (ex) {}
if (defaultAccount && defaultAccount.defaultIdentity)
return defaultAccount.defaultIdentity;
}
- return identities.queryElementAt(0, Components.interfaces.nsIMsgIdentity);
+ return identities.queryElementAt(0, Ci.nsIMsgIdentity);
}
function getIdentityForServer(server, optionalHint)
{
var identities = accountManager.getIdentitiesForServer(server);
return getBestIdentity(identities, optionalHint);
}
@@ -83,17 +83,17 @@ function getIdentityForHeader(hdr, type)
key = "delivered-to" + index++;
}
// Reverse the array so that the last delivered-to header will show at front.
deliveredTos.reverse();
for (let i = 0; i < deliveredTos.length; i++) {
for (let identity of fixIterator(accountManager.allIdentities,
- Components.interfaces.nsIMsgIdentity)) {
+ Ci.nsIMsgIdentity)) {
if (!identity.email)
continue;
// If the deliver-to header contains the defined identity, that's it.
if (deliveredTos[i] == identity.email.toLowerCase() ||
deliveredTos[i].includes("<" + identity.email.toLowerCase() + ">"))
return identity.email;
}
}
@@ -115,21 +115,21 @@ function getIdentityForHeader(hdr, type)
if (accountKey) {
let account = accountManager.getAccount(accountKey);
if (account)
server = account.incomingServer;
}
}
let hintForIdentity = "";
- if (type == Components.interfaces.nsIMsgCompType.ReplyToList)
+ if (type == Ci.nsIMsgCompType.ReplyToList)
hintForIdentity = findDeliveredToIdentityEmail();
- else if (type == Components.interfaces.nsIMsgCompType.Template ||
- type == Components.interfaces.nsIMsgCompType.EditTemplate ||
- type == Components.interfaces.nsIMsgCompType.EditAsNew)
+ else if (type == Ci.nsIMsgCompType.Template ||
+ type == Ci.nsIMsgCompType.EditTemplate ||
+ type == Ci.nsIMsgCompType.EditAsNew)
hintForIdentity = hdr.author;
else
hintForIdentity = hdr.recipients + "," + hdr.ccList + "," +
findDeliveredToIdentityEmail();
if (server)
identity = getIdentityForServer(server, hintForIdentity);
@@ -139,17 +139,17 @@ function getIdentityForHeader(hdr, type)
return identity;
}
function GetNextNMessages(folder)
{
if (folder) {
var newsFolder = folder.QueryInterface(
- Components.interfaces.nsIMsgNewsFolder);
+ Ci.nsIMsgNewsFolder);
if (newsFolder) {
newsFolder.getNextNMessages(msgWindow);
}
}
}
/**
* Figure out the message key from the message uri.
@@ -171,17 +171,17 @@ function GetMsgKeyFromURI(uri) {
*
* @param type nsIMsgCompType Type of composition (new message, reply, draft, etc.)
* @param format nsIMsgCompFormat Requested format (plain text, html, default)
* @param folder nsIMsgFolder Folder where the original message is stored
* @param messageArray Array of messages to process, often only holding one element.
*/
function ComposeMessage(type, format, folder, messageArray)
{
- let msgComposeType = Components.interfaces.nsIMsgCompType;
+ let msgComposeType = Ci.nsIMsgCompType;
let ignoreQuote = false;
let msgKey;
if (messageArray && messageArray.length == 1) {
msgKey = GetMsgKeyFromURI(messageArray[0]);
if (msgKey != gMessageDisplay.keyForCharsetOverride) {
msgWindow.charsetOverride = false;
}
if (type == msgComposeType.Reply ||
@@ -316,27 +316,27 @@ function ComposeMessage(type, format, fo
}
}
function NewMessageToSelectedAddresses(type, format, identity) {
var abSidebarPanel = document.commandDispatcher.focusedWindow;
var abResultsTree = abSidebarPanel.document.getElementById("abResultsTree");
var abResultsBoxObject = abResultsTree.treeBoxObject;
var abView = abResultsBoxObject.view;
- abView = abView.QueryInterface(Components.interfaces.nsIAbView);
+ abView = abView.QueryInterface(Ci.nsIAbView);
var addresses = abView.selectedAddresses;
- var params = Components.classes["@mozilla.org/messengercompose/composeparams;1"].createInstance(Components.interfaces.nsIMsgComposeParams);
+ var params = Cc["@mozilla.org/messengercompose/composeparams;1"].createInstance(Ci.nsIMsgComposeParams);
if (params) {
params.type = type;
params.format = format;
params.identity = identity;
- var composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"].createInstance(Components.interfaces.nsIMsgCompFields);
+ var composeFields = Cc["@mozilla.org/messengercompose/composefields;1"].createInstance(Ci.nsIMsgCompFields);
if (composeFields) {
let addressList = [];
- const nsISupportsString = Components.interfaces.nsISupportsString;
+ const nsISupportsString = Ci.nsISupportsString;
for (let i = 0; i < addresses.length; i++) {
addressList.push(addresses.queryElementAt(i, nsISupportsString).data);
}
composeFields.to = addressList.join(",");
params.composeFields = composeFields;
MailServices.compose.OpenComposeWindowWithParams(null, params);
}
}
@@ -351,17 +351,17 @@ function Subscribe(preselectedMsgFolder)
}
function SubscribeOKCallback(changeTable)
{
for (var serverURI in changeTable) {
var folder = MailUtils.getFolderForURI(serverURI, true);
var server = folder.server;
var subscribableServer =
- server.QueryInterface(Components.interfaces.nsISubscribableServer);
+ server.QueryInterface(Ci.nsISubscribableServer);
for (var name in changeTable[serverURI]) {
if (changeTable[serverURI][name] == true) {
try {
subscribableServer.subscribe(name);
}
catch (ex) {
dump("failed to subscribe to " + name + ": " + ex + "\n");
@@ -391,17 +391,17 @@ function SubscribeOKCallback(changeTable
function SaveAsFile(uris)
{
if (uris.length == 1) {
let uri = uris[0];
let msgHdr = messenger.messageServiceFromURI(uri)
.messageURIToMsgHdr(uri);
let name = msgHdr.mime2DecodedSubject;
- if (msgHdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe)
+ if (msgHdr.flags & Ci.nsMsgMessageFlags.HasRe)
name = (name) ? "Re: " + name : "Re: ";
let filename = GenerateValidFilename(name, ".eml");
messenger.saveAs(uri, true, null, filename);
}
else {
let filenames = [];
for (let i = 0; i < uris.length; i++) {
@@ -429,17 +429,17 @@ function GenerateFilenameFromMsgHdr(msgH
return date.getFullYear() + "-" +
pad(date.getMonth() + 1) + "-" +
pad(date.getDate()) + " " +
pad(date.getHours()) + "" +
pad(date.getMinutes()) + "";
}
let filename;
- if (msgHdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe)
+ if (msgHdr.flags & Ci.nsMsgMessageFlags.HasRe)
filename = (msgHdr.mime2DecodedSubject) ? "Re: " + msgHdr.mime2DecodedSubject : "Re: ";
else
filename = msgHdr.mime2DecodedSubject;
filename += " - ";
filename += msgHdr.mime2DecodedAuthor + " - ";
filename += MakeIS8601ODateString(new Date(msgHdr.date/1000));
--- a/mail/base/content/mailContextMenus.js
+++ b/mail/base/content/mailContextMenus.js
@@ -77,21 +77,21 @@ function fillMailContextMenu(event)
goUpdateCommand('cmd_printpreview');
goUpdateCommand('cmd_print');
updateCheckedStateForIgnoreAndWatchThreadCmds();
// Show "Edit Draft Message" menus only in a drafts folder; otherwise hide them.
showCommandInSpecialFolder("cmd_editDraftMsg",
- Components.interfaces.nsMsgFolderFlags.Drafts);
+ Ci.nsMsgFolderFlags.Drafts);
// Show "New Message from Template" and "Edit Template" menus only in a
// templates folder; otherwise hide them.
showCommandInSpecialFolder(["cmd_newMsgFromTemplate", "cmd_editTemplateMsg"],
- Components.interfaces.nsMsgFolderFlags.Templates);
+ Ci.nsMsgFolderFlags.Templates);
gContextMenu = new nsContextMenu(event.target, event.shiftKey);
return gContextMenu.shouldDisplay;
}
/**
* Set the message id to show as label in the context menu item designated
* for that purpose.
@@ -110,18 +110,18 @@ function FillMessageIdContextMenu(messag
// We don't want to show "Open Browser With Message-ID" for non-nntp messages.
document.getElementById("messageIdContext-openBrowserWithMsgId")
.hidden = !gFolderDisplay.selectedMessageIsNews;
}
function CopyMessageId(messageId)
{
- var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper);
clipboard.copyString(messageId);
}
function GetMessageIdFromNode(messageIdNode, cleanMessageId)
{
var messageId = messageIdNode.getAttribute("messageid");
@@ -136,26 +136,26 @@ function GetMessageIdFromNode(messageIdN
* Take the message id from the messageIdNode and use the url defined in the
* hidden pref "mailnews.messageid_browser.url" to open it in a browser window
* (%mid is replaced by the message id).
* @param messageId the message id to open
*/
function OpenBrowserWithMessageId(messageId)
{
var browserURL = Services.prefs.getComplexValue("mailnews.messageid_browser.url",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
browserURL = browserURL.replace(/%mid/, messageId);
try
{
messenger.launchExternalURL(browserURL);
}
catch (ex)
{
- Components.utils.reportError("Failed to open message-id in browser; " +
- "browserURL=" + browserURL);
+ Cu.reportError("Failed to open message-id in browser; " +
+ "browserURL=" + browserURL);
}
}
/**
* Take the message id from the messageIdNode, search for the corresponding
* message in all folders starting with the current selected folder, then the
* current account followed by the other accounts and open corresponding
* message if found.
@@ -175,17 +175,17 @@ function OpenMessageForMessageId(message
{
let allServers = MailServices.accounts.allServers;
messageHeader = SearchForMessageIdInSubFolder(startServer.rootFolder, messageId);
for (let i = 0; i < allServers.length && !messageHeader; i++)
{
let currentServer =
- allServers.queryElementAt(i, Components.interfaces.nsIMsgIncomingServer);
+ allServers.queryElementAt(i, Ci.nsIMsgIncomingServer);
if (currentServer && startServer != currentServer &&
currentServer.canSearchMessages && !currentServer.isDeferredTo)
{
messageHeader = SearchForMessageIdInSubFolder(currentServer.rootFolder, messageId);
}
}
}
window.setCursor("auto");
@@ -264,17 +264,17 @@ function SearchForMessageIdInSubFolder(f
if (!folder.isServer)
messageHeader = CheckForMessageIdInFolder(folder, messageId);
// search subfolders recursively
while (subFolders.hasMoreElements() && !messageHeader)
{
// search in current folder
var currentFolder =
- subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
+ subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
messageHeader = CheckForMessageIdInFolder(currentFolder, messageId);
// search in its subfolder
if (!messageHeader && currentFolder.hasSubFolders)
messageHeader = SearchForMessageIdInSubFolder(currentFolder, messageId);
}
return messageHeader;
@@ -289,21 +289,21 @@ function CheckForMessageIdInFolder(folde
var messageDatabase = folder.msgDatabase;
var messageHeader;
try
{
messageHeader = messageDatabase.getMsgHdrForMessageID(messageId);
}
catch (ex)
{
- Components.utils.reportError("Failed to find message-id in folder; " +
- "messageId=" + messageId);
+ Cu.reportError("Failed to find message-id in folder; " +
+ "messageId=" + messageId);
}
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
if (!MailServices.mailSession.IsFolderOpenInWindow(folder) &&
!(folder.flags & (nsMsgFolderFlags.Trash | nsMsgFolderFlags.Inbox)))
{
folder.msgDatabase = null;
}
return messageHeader;
}
@@ -339,17 +339,17 @@ function fillFolderPaneContextMenu(aEven
var bundle = document.getElementById("bundle_messenger");
var folders = gFolderTreeView.getSelectedFolders();
if (!folders.length)
return false;
var numSelected = folders.length;
function checkIsVirtualFolder(folder) {
- const kVirtualFlag = Components.interfaces.nsMsgFolderFlags.Virtual;
+ const kVirtualFlag = Ci.nsMsgFolderFlags.Virtual;
return folder.flags & kVirtualFlag;
}
var haveAnyVirtualFolders = folders.some(checkIsVirtualFolder);
function checkIsServer(folder) {
return folder.isServer;
}
var selectedServers = folders.filter(checkIsServer);
@@ -384,17 +384,17 @@ function fillFolderPaneContextMenu(aEven
var haveOnlyNewsgroups = folders.every(checkIsNewsgroup);
function checkIsMailFolder(folder) {
return !folder.isServer && folder.server.type != "nntp";
}
var haveOnlyMailFolders = folders.every(checkIsMailFolder);
function checkCanGetMessages(folder) {
- const kTrashFlag = Components.interfaces.nsMsgFolderFlags.Trash;
+ const kTrashFlag = Ci.nsMsgFolderFlags.Trash;
return (folder.isServer && (folder.server.type != "none")) ||
checkIsNewsgroup(folder) ||
((folder.server.type == "rss") && !folder.isSpecialFolder(kTrashFlag, true) &&
!checkIsVirtualFolder(folder));
}
var selectedFoldersThatCanGetMessages = folders.filter(checkCanGetMessages);
// --- Set up folder properties / account settings menu item.
@@ -498,17 +498,17 @@ function fillFolderPaneContextMenu(aEven
function checkIsDeleteEnabled(folder) {
return folder.isCommandEnabled("cmd_delete");
}
var haveOnlyDeleteEnabledFolders = folders.every(checkIsDeleteEnabled);
EnableMenuItem("folderPaneContext-remove", haveOnlyDeleteEnabledFolders);
// --- Set up the compact folder menu item.
function checkCanCompactFolder(folder) {
- const kVirtualFlag = Components.interfaces.nsMsgFolderFlags.Virtual;
+ const kVirtualFlag = Ci.nsMsgFolderFlags.Virtual;
return folder.canCompact && !(folder.flags & kVirtualFlag) &&
folder.isCommandEnabled("cmd_compactFolder");
}
var haveOnlyCompactableFolders = folders.every(checkCanCompactFolder);
ShowMenuItem("folderPaneContext-compact", haveOnlyCompactableFolders);
function checkIsCompactEnabled(folder) {
return folder.isCommandEnabled("cmd_compactFolder");
@@ -516,17 +516,17 @@ function fillFolderPaneContextMenu(aEven
var haveOnlyCompactEnabledFolders = folders.every(checkIsCompactEnabled);
EnableMenuItem("folderPaneContext-compact", haveOnlyCompactEnabledFolders);
// --- Set up favorite folder menu item.
ShowMenuItem("folderPaneContext-favoriteFolder",
numSelected == 1 && !folders[0].isServer);
if (numSelected == 1 && !folders[0].isServer)
{
- const kFavoriteFlag = Components.interfaces.nsMsgFolderFlags.Favorite;
+ const kFavoriteFlag = Ci.nsMsgFolderFlags.Favorite;
// Adjust the checked state on the menu item.
document.getElementById("folderPaneContext-favoriteFolder")
.setAttribute("checked", folders[0].getFlag(kFavoriteFlag));
}
// --- Set up the empty trash menu item.
ShowMenuItem("folderPaneContext-emptyTrash",
numSelected == 1 && specialFolder == "Trash");
@@ -635,23 +635,23 @@ function addEmail()
window.openDialog("chrome://messenger/content/addressbook/abNewCardDialog.xul",
"",
"chrome,resizable=no,titlebar,modal,centerscreen",
{primaryEmail: addresses});
}
function composeEmailTo()
{
- let fields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
- .createInstance(Components.interfaces.nsIMsgCompFields);
- let params = Components.classes["@mozilla.org/messengercompose/composeparams;1"]
- .createInstance(Components.interfaces.nsIMsgComposeParams);
+ let fields = Cc["@mozilla.org/messengercompose/composefields;1"]
+ .createInstance(Ci.nsIMsgCompFields);
+ let params = Cc["@mozilla.org/messengercompose/composeparams;1"]
+ .createInstance(Ci.nsIMsgComposeParams);
fields.to = getEmail(gContextMenu.linkURL);
- params.type = Components.interfaces.nsIMsgCompType.New;
- params.format = Components.interfaces.nsIMsgCompFormat.Default;
+ params.type = Ci.nsIMsgCompType.New;
+ params.format = Ci.nsIMsgCompFormat.Default;
if (gFolderDisplay.displayedFolder) {
params.identity = accountManager.getFirstIdentityForServer(
gFolderDisplay.displayedFolder.server);
}
params.composeFields = fields;
MailServices.compose.OpenComposeWindowWithParams(null, params);
}
@@ -663,37 +663,37 @@ function getEmail (url)
if ( qmark > mailtolength )
addresses = url.substring( mailtolength, qmark );
else
addresses = url.substr( mailtolength );
// Let's try to unescape it using a character set
try {
var characterSet = gContextMenu.target.ownerDocument.characterSet;
- const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
- .getService(Components.interfaces.nsITextToSubURI);
+ const textToSubURI = Cc["@mozilla.org/intl/texttosuburi;1"]
+ .getService(Ci.nsITextToSubURI);
addresses = textToSubURI.unEscapeURIForUI(characterSet, addresses);
}
catch(ex) {
// Do nothing.
}
return addresses;
}
function CopyMessageUrl()
{
try {
var hdr = gDBView.hdrForFirstSelectedMessage;
var server = hdr.folder.server;
// TODO let backend construct URL and return as attribute
- var url = (server.socketType == Components.interfaces.nsMsgSocketType.SSL) ?
+ var url = (server.socketType == Ci.nsMsgSocketType.SSL) ?
"snews://" : "news://";
url += server.hostName + ":" + server.port + "/" + hdr.messageId;
- var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper);
clipboard.copyString(url);
}
catch (ex) {
dump("ex="+ex+"\n");
}
}
--- a/mail/base/content/mailCore.js
+++ b/mail/base/content/mailCore.js
@@ -383,19 +383,19 @@ function showChatTab()
function toImport()
{
window.openDialog("chrome://messenger/content/importDialog.xul", "importDialog",
"chrome, modal, titlebar, centerscreen");
}
function toSanitize()
{
- Components.classes["@mozilla.org/mail/mailglue;1"]
- .getService(Components.interfaces.nsIMailGlue)
- .sanitize(window);
+ Cc["@mozilla.org/mail/mailglue;1"]
+ .getService(Ci.nsIMailGlue)
+ .sanitize(window);
}
/**
* Opens the Preferences (Options) dialog.
*
* @param aPaneID ID of prefpane to select automatically.
* @param aTabID ID of tab to select on the prefpane.
* @param aOtherArgs other prefpane specific arguments
@@ -432,22 +432,22 @@ function openOptionsDialog(aPaneID, aTab
function openAddonsMgr(aView)
{
if (aView) {
let emWindow;
let browserWindow;
let receivePong = function receivePong(aSubject, aTopic, aData) {
- let browserWin = aSubject.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+ let browserWin = aSubject.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
if (!emWindow || browserWin == window /* favor the current window */) {
emWindow = aSubject;
browserWindow = browserWin;
}
}
Services.obs.addObserver(receivePong, "EM-pong");
Services.obs.notifyObservers(null, "EM-ping");
Services.obs.removeObserver(receivePong, "EM-pong");
@@ -489,18 +489,18 @@ function openAddonPrefs(aURL, aOptionsTy
(instantApply ? ",dialog=no" : ",modal");
window.openDialog(aURL, "addonPrefs", features);
}
}
function openActivityMgr()
{
- Components.classes['@mozilla.org/activity-manager-ui;1'].
- getService(Components.interfaces.nsIActivityManagerUI).show(window);
+ Cc['@mozilla.org/activity-manager-ui;1'].
+ getService(Ci.nsIActivityManagerUI).show(window);
}
function openIMAccountMgr()
{
var win = Services.wm.getMostRecentWindow("Messenger:Accounts");
if (win)
win.focus();
else {
@@ -599,18 +599,18 @@ function openSupportURL()
* @param aPrefName - name of the pref that holds the url we want to format and open
*/
function openFormattedURL(aPrefName)
{
var urlToOpen = Services.urlFormatter.formatURLPref(aPrefName);
var uri = Services.io.newURI(urlToOpen);
- var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ var protocolSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
protocolSvc.loadURI(uri);
}
/**
* Opens the Troubleshooting page in a new tab.
*/
function openAboutSupport() {
let tabmail = document.getElementById("tabmail");
@@ -634,18 +634,18 @@ function safeModeRestart()
(Services.prompt.BUTTON_POS_1 *
Services.prompt.BUTTON_TITLE_CANCEL) +
Services.prompt.BUTTON_POS_0_DEFAULT;
let rv = Services.prompt.confirmEx(window, promptTitle, promptMessage,
buttonFlags, restartText, null, null,
null, {});
if (rv == 0) {
- let environment = Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment);
+ let environment = Cc["@mozilla.org/process/environment;1"]
+ .getService(Ci.nsIEnvironment);
environment.set("MOZ_SAFE_MODE_RESTART", "1");
BrowserUtils.restartApplication();
}
}
function getMostRecentMailWindow() {
let win = null;
if (AppConstants.platform != "win") {
@@ -729,52 +729,52 @@ function CreateAttachmentTransferData(aA
data.addDataForFlavour("text/x-moz-url",
info + "\n" + name + "\n" + aAttachment.size);
data.addDataForFlavour("text/x-moz-url-data", aAttachment.url);
data.addDataForFlavour("text/x-moz-url-desc", name);
data.addDataForFlavour("application/x-moz-file-promise-url",
aAttachment.url);
data.addDataForFlavour("application/x-moz-file-promise",
new nsFlavorDataProvider(), 0,
- Components.interfaces.nsISupports);
+ Ci.nsISupports);
}
return data;
}
function nsFlavorDataProvider()
{
}
nsFlavorDataProvider.prototype =
{
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIFlavorDataProvider) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIFlavorDataProvider) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
getFlavorData : function(aTransferable, aFlavor, aData, aDataLen)
{
// get the url for the attachment
if (aFlavor == "application/x-moz-file-promise")
{
var urlPrimitive = { };
var dataSize = { };
aTransferable.getTransferData("application/x-moz-file-promise-url",
urlPrimitive, dataSize);
- var srcUrlPrimitive = urlPrimitive.value.QueryInterface(Components.interfaces.nsISupportsString);
+ var srcUrlPrimitive = urlPrimitive.value.QueryInterface(Ci.nsISupportsString);
// now get the destination file location from kFilePromiseDirectoryMime
var dirPrimitive = {};
aTransferable.getTransferData("application/x-moz-file-promise-dir",
dirPrimitive, dataSize);
- var destDirectory = dirPrimitive.value.QueryInterface(Components.interfaces.nsIFile);
+ var destDirectory = dirPrimitive.value.QueryInterface(Ci.nsIFile);
// now save the attachment to the specified location
// XXX: we need more information than just the attachment url to save it,
// fortunately, we have an array of all the current attachments so we can
// cheat and scan through them
var attachment = null;
for (let index of currentAttachments.keys())
@@ -788,14 +788,14 @@ nsFlavorDataProvider.prototype =
if (attachment)
{
var name = attachment.name || attachment.displayName;
var destFilePath = messenger.saveAttachmentToFolder(attachment.contentType,
attachment.url,
encodeURIComponent(name),
attachment.uri,
destDirectory);
- aData.value = destFilePath.QueryInterface(Components.interfaces.nsISupports);
+ aData.value = destFilePath.QueryInterface(Ci.nsISupports);
aDataLen.value = 4;
}
}
}
}
--- a/mail/base/content/mailOverlay.xul
+++ b/mail/base/content/mailOverlay.xul
@@ -24,18 +24,18 @@
// identity, based on the selected message or folder
// if not, bring up the compose window to the default identity
if ("MsgNewMessage" in window) {
MsgNewMessage(null);
return;
}
MailServices.compose.OpenComposeWindow(null, null, null,
- Components.interfaces.nsIMsgCompType.New,
- Components.interfaces.nsIMsgCompFormat.Default,
+ Ci.nsIMsgCompType.New,
+ Ci.nsIMsgCompFormat.Default,
null, null);
}
]]>
</script>
<!-- generic commands -->
<commandset id="tasksCommands">
--- a/mail/base/content/mailTabs.js
+++ b/mail/base/content/mailTabs.js
@@ -178,20 +178,20 @@ var mailTabType = {
return retval;
} catch (e) {
logException(e);
return null;
}
},
restoreTab: function(aTabmail, aPersistedState) {
try {
- let rdfService = Components.classes['@mozilla.org/rdf/rdf-service;1']
- .getService(Components.interfaces.nsIRDFService);
+ let rdfService = Cc['@mozilla.org/rdf/rdf-service;1']
+ .getService(Ci.nsIRDFService);
let folder = rdfService.GetResource(aPersistedState.folderURI)
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
// if the folder no longer exists, we can't restore the tab
if (folder) {
let folderPaneVisible = ("folderPaneVisible" in aPersistedState) ?
aPersistedState.folderPaneVisible :
true;
// If we are talking about the first tab, it already exists and we
// should poke it. We are assuming it is the currently displayed
// tab because we are privvy to the implementation details and know
@@ -382,27 +382,27 @@ var mailTabType = {
// Try and figure out the selected message if one was not provided.
// It is possible that the folder has yet to load, so it may still be
// null.
if (aMsgHdr == null)
aMsgHdr = aTab.folderDisplay.selectedMessage;
aTab.title = "";
if (aMsgHdr == null)
return;
- if (aMsgHdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe)
+ if (aMsgHdr.flags & Ci.nsMsgMessageFlags.HasRe)
aTab.title = "Re: ";
if (aMsgHdr.mime2DecodedSubject)
aTab.title += aMsgHdr.mime2DecodedSubject;
aTab.title += " - " + aMsgHdr.folder.prettyName;
if (this._getNumberOfRealAccounts() > 1)
aTab.title += " - " + aMsgHdr.folder.server.prettyName;
// Set the favicon for feed messages.
- if (aMsgHdr.flags & Components.interfaces.nsMsgMessageFlags.FeedMsg &&
+ if (aMsgHdr.flags & Ci.nsMsgMessageFlags.FeedMsg &&
!aTab.tabNode.hasAttribute("IsFeedMessage")) {
aTab.tabNode.setAttribute("IsFeedMessage", true);
if (!Services.prefs.getBoolPref("browser.chrome.site_icons") ||
!Services.prefs.getBoolPref("browser.chrome.favicons"))
return;
MsgHdrToMimeMessage(aMsgHdr, null, function(aMsgHdr, aMimeMsg, tabNode) {
if (aMimeMsg && aMimeMsg.headers["content-base"] &&
@@ -500,29 +500,29 @@ var mailTabType = {
document.getElementById("messagepane").setAttribute("type", "content");
document.getElementById("messagepane").setAttribute("primary", "true");
aTab.messageDisplay = aMessageDisplay;
aTab.folderDisplay = new FolderDisplayWidget(aTab, aTab.messageDisplay);
aTab.folderDisplay.msgWindow = msgWindow;
aTab.folderDisplay.tree = document.getElementById("threadTree");
aTab.folderDisplay.treeBox = aTab.folderDisplay.tree.boxObject.QueryInterface(
- Components.interfaces.nsITreeBoxObject);
+ Ci.nsITreeBoxObject);
aTab.folderDisplay.folderPaneVisible = aFolderPaneVisible;
if (aIsFirstTab) {
aTab.folderDisplay.messenger = messenger;
}
else {
// Each tab gets its own messenger instance; this provides each tab with
// its own undo/redo stack and back/forward navigation history.
// If this is a foreground tab, folderDisplay.makeActive() is going to
// set it as the global messenger, so there's no need to do it here
- let tabMessenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ let tabMessenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
tabMessenger.setWindow(window, msgWindow);
aTab.folderDisplay.messenger = tabMessenger;
}
},
closeTab: function(aTab) {
aTab.folderDisplay.close();
},
--- a/mail/base/content/mailWidgets.xml
+++ b/mail/base/content/mailWidgets.xml
@@ -28,18 +28,18 @@
children.filter(aChild => aChild.getAttribute("selected") == "true")
.forEach(this.selectedItems.append, this.selectedItems);
children.filter(aChild => !aChild.hasAttribute("context"))
.forEach(aChild => aChild.setAttribute("context",
this.getAttribute("itemcontext")));
this.sizes = {small: 16, large: 32, tile: 32};
- this.messenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ this.messenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
]]></constructor>
<!-- ///////////////// public members ///////////////// -->
<property name="view">
<getter><![CDATA[
return this.getAttribute("view");
@@ -132,17 +132,17 @@
for (let i = estimatedIndex; i < this._childNodes.length; i++) {
let childBoxObj = this._childNodes[i].boxObject;
if (childBoxObj.screenY + childBoxObj.height >
box.boxObject.screenY > 0)
return i;
}
// If we get here, something is very wrong.
- Components.utils.reportError(
+ Cu.reportError(
"Couldn't get index of first visible row for attachmentlist!\n");
return -1;
}
]]></body>
</method>
<method name="ensureIndexIsVisible">
<parameter name="index"/>
<body><![CDATA[
@@ -796,17 +796,17 @@
fillAddressesNode to display at most maxLinesBeforeMore lines of
addresses plus the (more) widget which can be clicked to reveal
the rest. The "singleline" attribute is set for one line only. -->
<method name="buildViews">
<body>
<![CDATA[
this.maxLinesBeforeMore = Services.prefs.getIntPref(
"mailnews.headers.show_n_lines_before_more");
- const dt = Components.interfaces.nsMimeHeaderDisplayTypes;
+ const dt = Ci.nsMimeHeaderDisplayTypes;
let headerchoice = Services.prefs.getIntPref("mail.show_headers");
if (this.maxLinesBeforeMore < 1 ||
headerchoice == dt.AllHeaders) {
this.fillAddressesNode(this.emailAddresses, true);
this.longEmailAddresses.removeAttribute("singleline");
}
else {
this.fillAddressesNode(this.emailAddresses, false);
@@ -1350,17 +1350,17 @@
</xul:menulist>
</content>
<implementation>
<field name="internalScope">null</field>
<field name="internalValue">-1</field>
<field readonly="true" name="validityManager">
<![CDATA[
- Components.classes['@mozilla.org/mail/search/validityManager;1'].getService(Components.interfaces.nsIMsgSearchValidityManager);
+ Cc['@mozilla.org/mail/search/validityManager;1'].getService(Ci.nsIMsgSearchValidityManager);
]]>
</field>
<property name="searchScope" onget="return this.internalScope;">
<!-- scope ID - retrieve the table -->
<setter>
<![CDATA[
// if scope isn't changing this is a noop
if (this.internalScope == val) return val;
@@ -1495,17 +1495,17 @@
while (popup.hasChildNodes())
popup.lastChild.remove();
var newSelection;
var customizePos=-1;
for (var i = 0; i < menuItemIds.length; ++i)
{
// create the menuitem
- if (Components.interfaces.nsMsgSearchAttrib.OtherHeader == menuItemIds[i].toString())
+ if (Ci.nsMsgSearchAttrib.OtherHeader == menuItemIds[i].toString())
customizePos = i;
else
{
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", menuItemStrings[i]);
menuitem.setAttribute("value", menuItemIds[i]);
popup.appendChild(menuitem);
// try to restore the selection
@@ -1533,26 +1533,26 @@
]]>
</body>
</method>
<method name="onSelect">
<parameter name="event"/>
<body>
<![CDATA[
var menulist = document.getAnonymousNodes(this)[0];
- if (menulist.value == Components.interfaces.nsMsgSearchAttrib.OtherHeader)
+ if (menulist.value == Ci.nsMsgSearchAttrib.OtherHeader)
{
// Customize menuitem selected.
let args = {};
window.openDialog("chrome://messenger/content/CustomHeaders.xul",
"", "modal,centerscreen,resizable,titlebar,chrome",
args);
// User may have removed the custom header currently selected
// in the menulist so temporarily set the selection to a safe value.
- this.value = Components.interfaces.nsMsgSearchAttrib.OtherHeader;
+ this.value = Ci.nsMsgSearchAttrib.OtherHeader;
// rebuild the menulist
UpdateAfterCustomHeaderChange();
// Find the created or chosen custom header and select it.
if (args.selectedVal) {
let menuitem = menulist.querySelector('[label="' + args.selectedVal + '"]');
this.value = menuitem.value;
} else {
// Nothing was picked in the custom headers editor so just pick something
@@ -1585,21 +1585,21 @@
if (isNaN(this.value)) // is this a custom term?
{
let customTerm = MailServices.filters.getCustomTerm(this.value);
if (customTerm)
return customTerm.name;
else
{ // The custom term may be missing after the extension that added it
// was disabled or removed. We need to notify the user.
- let scriptError = Components.classes["@mozilla.org/scripterror;1"]
- .createInstance(Components.interfaces.nsIScriptError);
+ let scriptError = Cc["@mozilla.org/scripterror;1"]
+ .createInstance(Ci.nsIScriptError);
scriptError.init("Missing custom search term " + this.value,
null, null, 0, 0,
- Components.interfaces.nsIScriptError.errorFlag,
+ Ci.nsIScriptError.errorFlag,
"component javascript");
this.Services.console.logMessage(scriptError);
return this.stringBundle.GetStringFromName("MissingCustomTerm");
}
}
return this.stringBundle.GetStringFromName(
this.validityManager.getAttributeProperty(parseInt(this.value)));
]]>
@@ -1611,17 +1611,17 @@
var length = new Object;
let result = this.validityTable.getAvailableAttributes(length);
// add any available custom search terms
let customEnum = MailServices.filters.getCustomTerms();
while (customEnum && customEnum.hasMoreElements())
{
let customTerm =
customEnum.getNext()
- .QueryInterface(Components.interfaces.nsIMsgSearchCustomTerm);
+ .QueryInterface(Ci.nsIMsgSearchCustomTerm);
// for custom terms, the array element is a string with the custom id
// instead of the integer attribute
if (customTerm.getAvailable(this.searchScope, null))
result.push(customTerm.id);
}
return result;
]]>
</getter>
@@ -1648,17 +1648,17 @@
if (isNaN(ids[i])) // Is this a custom search term?
{
let customTerm = MailServices.filters.getCustomTerm(ids[i]);
if (customTerm)
strings[i] = customTerm.name;
else
strings[i] = "";
}
- else if(ids[i] > Components.interfaces.nsMsgSearchAttrib.OtherHeader && hdrsArray)
+ else if(ids[i] > Ci.nsMsgSearchAttrib.OtherHeader && hdrsArray)
strings[i] = hdrsArray[j++];
else
strings[i] = this.stringBundle.GetStringFromName(
this.validityManager.getAttributeProperty(ids[i]));
}
return strings;
]]>
</getter>
@@ -1695,17 +1695,17 @@
<![CDATA[
var length = new Object;
let isCustom = isNaN(this.searchAttribute);
if (isCustom)
{
let customTerm = MailServices.filters.getCustomTerm(this.searchAttribute);
if (customTerm)
return customTerm.getAvailableOperators(this.searchScope, length);
- return [Components.interfaces.nsMsgSearchOp.Contains];
+ return [Ci.nsMsgSearchOp.Contains];
}
return this.validityTable.getAvailableOperators(this.searchAttribute,length);
]]>
</getter>
</property>
<property name="valueStrings" readonly="true">
<getter>
<![CDATA[
@@ -1715,23 +1715,23 @@
strings[i] = this.stringBundle.GetStringFromID(ids[i]);
return strings;
]]>
</getter>
</property>
<property name="parentValue">
<setter>
<![CDATA[
- if (this.searchAttribute == val && val != Components.interfaces.nsMsgSearchAttrib.OtherHeader) return val;
+ if (this.searchAttribute == val && val != Ci.nsMsgSearchAttrib.OtherHeader) return val;
this.searchAttribute = val;
this.refreshList(true); // don't restore the selection, since searchvalue nulls it
- if (val == Components.interfaces.nsMsgSearchAttrib.AgeInDays)
+ if (val == Ci.nsMsgSearchAttrib.AgeInDays)
{
// We want "Age in Days" to default to "is less than".
- this.value = Components.interfaces.nsMsgSearchOp.IsLessThan;
+ this.value = Ci.nsMsgSearchOp.IsLessThan;
}
return val;
]]>
</setter>
<getter>
<![CDATA[
return this.searchAttribute;
]]>
@@ -1816,67 +1816,67 @@
<property name="opParentValue" onget="return this.internalOperator;">
<setter>
<![CDATA[
// noop if we're not changing it
if (this.internalOperator == val)
return val;
// Keywords has the null field IsEmpty
- if (this.searchAttribute == Components.interfaces.nsMsgSearchAttrib.Keywords) {
- if (val == Components.interfaces.nsMsgSearchOp.IsEmpty ||
- val == Components.interfaces.nsMsgSearchOp.IsntEmpty)
+ if (this.searchAttribute == Ci.nsMsgSearchAttrib.Keywords) {
+ if (val == Ci.nsMsgSearchOp.IsEmpty ||
+ val == Ci.nsMsgSearchOp.IsntEmpty)
this.setAttribute("selectedIndex", "-1");
else
this.setAttribute("selectedIndex", "5");
}
// JunkStatus has the null field IsEmpty
- if (this.searchAttribute == Components.interfaces.nsMsgSearchAttrib.JunkStatus) {
- if (val == Components.interfaces.nsMsgSearchOp.IsEmpty ||
- val == Components.interfaces.nsMsgSearchOp.IsntEmpty)
+ if (this.searchAttribute == Ci.nsMsgSearchAttrib.JunkStatus) {
+ if (val == Ci.nsMsgSearchOp.IsEmpty ||
+ val == Ci.nsMsgSearchOp.IsntEmpty)
this.setAttribute("selectedIndex", "-1");
else
this.setAttribute("selectedIndex", "6");
}
// if it's not sender, to, cc, alladdresses, or toorcc, we don't care
- if (this.searchAttribute != Components.interfaces.nsMsgSearchAttrib.Sender &&
- this.searchAttribute != Components.interfaces.nsMsgSearchAttrib.To &&
- this.searchAttribute != Components.interfaces.nsMsgSearchAttrib.ToOrCC &&
- this.searchAttribute != Components.interfaces.nsMsgSearchAttrib.AllAddresses &&
- this.searchAttribute != Components.interfaces.nsMsgSearchAttrib.CC ) {
+ if (this.searchAttribute != Ci.nsMsgSearchAttrib.Sender &&
+ this.searchAttribute != Ci.nsMsgSearchAttrib.To &&
+ this.searchAttribute != Ci.nsMsgSearchAttrib.ToOrCC &&
+ this.searchAttribute != Ci.nsMsgSearchAttrib.AllAddresses &&
+ this.searchAttribute != Ci.nsMsgSearchAttrib.CC ) {
this.internalOperator = val;
return val;
}
var children = document.getAnonymousNodes(this);
- if (val == Components.interfaces.nsMsgSearchOp.IsntInAB ||
- val == Components.interfaces.nsMsgSearchOp.IsInAB) {
+ if (val == Ci.nsMsgSearchOp.IsntInAB ||
+ val == Ci.nsMsgSearchOp.IsInAB) {
// if the old internalOperator was
// IsntInAB or IsInAB, and the new internalOperator is
// IsntInAB or IsInAB, noop because the search value
// was an ab type, and it still is.
// otherwise, switch to the ab picker and select the PAB
- if (this.internalOperator != Components.interfaces.nsMsgSearchOp.IsntInAB &&
- this.internalOperator != Components.interfaces.nsMsgSearchOp.IsInAB) {
+ if (this.internalOperator != Ci.nsMsgSearchOp.IsntInAB &&
+ this.internalOperator != Ci.nsMsgSearchOp.IsInAB) {
var abs = children[4].querySelector('[value="moz-abmdbdirectory://abook.mab"]');
if (abs)
children[4].selectedItem = abs;
this.setAttribute("selectedIndex", "4");
}
}
else {
// if the old internalOperator wasn't
// IsntInAB or IsInAB, and the new internalOperator isn't
// IsntInAB or IsInAB, noop because the search value
// wasn't an ab type, and it still isn't.
// otherwise, switch to the textbox and clear it
- if (this.internalOperator == Components.interfaces.nsMsgSearchOp.IsntInAB ||
- this.internalOperator == Components.interfaces.nsMsgSearchOp.IsInAB) {
+ if (this.internalOperator == Ci.nsMsgSearchOp.IsntInAB ||
+ this.internalOperator == Ci.nsMsgSearchOp.IsInAB) {
children[0].value = "";
this.setAttribute("selectedIndex", "0");
}
}
this.internalOperator = val;
return val;
]]>
@@ -1902,54 +1902,54 @@
this.setAttribute("selectedIndex", "10");
let customHbox = document.getAnonymousNodes(this)[10];
if (this.internalValue)
customHbox.setAttribute("value", this.internalValue.str);
// the searchAttribute attribute is intended as a selector in
// CSS for custom search terms to bind a custom value
customHbox.setAttribute("searchAttribute", val);
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.Priority)
+ else if (val == Ci.nsMsgSearchAttrib.Priority)
this.setAttribute("selectedIndex", "1");
- else if (val == Components.interfaces.nsMsgSearchAttrib.MsgStatus)
+ else if (val == Ci.nsMsgSearchAttrib.MsgStatus)
this.setAttribute("selectedIndex", "2");
- else if (val == Components.interfaces.nsMsgSearchAttrib.Date)
+ else if (val == Ci.nsMsgSearchAttrib.Date)
this.setAttribute("selectedIndex", "3");
- else if (val == Components.interfaces.nsMsgSearchAttrib.Sender) {
+ else if (val == Ci.nsMsgSearchAttrib.Sender) {
// since the internalOperator is null
// this is the same as the initial state
// the initial state for Sender isn't an ab type search
// it's a text search, so show the textbox
this.setAttribute("selectedIndex", "0");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.Keywords) {
+ else if (val == Ci.nsMsgSearchAttrib.Keywords) {
this.setAttribute("selectedIndex", "5");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.JunkStatus) {
+ else if (val == Ci.nsMsgSearchAttrib.JunkStatus) {
this.setAttribute("selectedIndex", "6");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.HasAttachmentStatus) {
+ else if (val == Ci.nsMsgSearchAttrib.HasAttachmentStatus) {
this.setAttribute("selectedIndex", "7");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.JunkScoreOrigin) {
+ else if (val == Ci.nsMsgSearchAttrib.JunkScoreOrigin) {
this.setAttribute("selectedIndex", "8");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.AgeInDays) {
+ else if (val == Ci.nsMsgSearchAttrib.AgeInDays) {
let valueBox = document.getAnonymousNodes(this)[9];
valueBox.min = -40000; // ~-100 years
valueBox.max = 40000; // ~100 years
this.setAttribute("selectedIndex", "9");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.Size) {
+ else if (val == Ci.nsMsgSearchAttrib.Size) {
let valueBox = document.getAnonymousNodes(this)[9];
valueBox.min = 0;
valueBox.max = 1000000000;
this.setAttribute("selectedIndex", "9");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.JunkPercent) {
+ else if (val == Ci.nsMsgSearchAttrib.JunkPercent) {
let valueBox = document.getAnonymousNodes(this)[9];
valueBox.min = 0;
valueBox.max = 100;
this.setAttribute("selectedIndex", "9");
}
else {
// a normal text field
this.setAttribute("selectedIndex", "0");
@@ -1959,17 +1959,17 @@
</setter>
</property>
<property name="value" onget="return this.internalValue;">
<setter>
<![CDATA[
// val is a nsIMsgSearchValue object
this.internalValue = val;
var attrib = this.internalAttribute;
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
+ var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
var children = document.getAnonymousNodes(this);
this.searchAttribute = attrib;
if (isNaN(attrib)) // a custom term
{
let customHbox = document.getAnonymousNodes(this)[10];
customHbox.setAttribute("value", val.str);
return val;
}
@@ -1990,18 +1990,18 @@
else if (attrib == nsMsgSearchAttrib.Date)
children[3].value = convertPRTimeToString(val.date);
else if (attrib == nsMsgSearchAttrib.Sender ||
attrib == nsMsgSearchAttrib.To ||
attrib == nsMsgSearchAttrib.CC ||
attrib == nsMsgSearchAttrib.AllAddresses ||
attrib == nsMsgSearchAttrib.ToOrCC)
{
- if (this.internalOperator == Components.interfaces.nsMsgSearchOp.IsntInAB ||
- this.internalOperator == Components.interfaces.nsMsgSearchOp.IsInAB) {
+ if (this.internalOperator == Ci.nsMsgSearchOp.IsntInAB ||
+ this.internalOperator == Ci.nsMsgSearchOp.IsInAB) {
var abs = children[4].querySelector('[value="' + val.str + '"]');
if (abs)
children[4].selectedItem = abs;
}
else
children[0].value = val.str;
}
else if (attrib == nsMsgSearchAttrib.Keywords)
@@ -2043,17 +2043,17 @@
]]>
</setter>
</property>
<method name="save">
<body>
<![CDATA[
var searchValue = this.value;
var searchAttribute = this.searchAttribute;
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
+ var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
var children = document.getAnonymousNodes(this);
searchValue.attrib = searchAttribute;
if (searchAttribute == nsMsgSearchAttrib.Priority) {
searchValue.priority = children[1].selectedItem.value;
}
else if (searchAttribute == nsMsgSearchAttrib.MsgStatus)
searchValue.status = children[2].value;
@@ -2062,18 +2062,18 @@
else if (searchAttribute == nsMsgSearchAttrib.Date)
searchValue.date = convertStringToPRTime(children[3].value);
else if (searchAttribute == nsMsgSearchAttrib.Sender ||
searchAttribute == nsMsgSearchAttrib.To ||
searchAttribute == nsMsgSearchAttrib.CC ||
searchAttribute == nsMsgSearchAttrib.AllAddresses ||
searchAttribute == nsMsgSearchAttrib.ToOrCC)
{
- if (this.internalOperator == Components.interfaces.nsMsgSearchOp.IsntInAB ||
- this.internalOperator == Components.interfaces.nsMsgSearchOp.IsInAB)
+ if (this.internalOperator == Ci.nsMsgSearchOp.IsntInAB ||
+ this.internalOperator == Ci.nsMsgSearchOp.IsInAB)
searchValue.str = children[4].selectedItem.value;
else
searchValue.str = children[0].value;
}
else if (searchAttribute == nsMsgSearchAttrib.Keywords)
{
searchValue.str = children[5].value;
}
@@ -2164,17 +2164,17 @@
this.initialize(document.getAnonymousNodes(this)[1], bundle);
// initialize the status picker
this.initialize(document.getAnonymousNodes(this)[2], bundle);
// initialize the date picker
var datePicker = document.getAnonymousNodes(this)[3];
var searchAttribute = this.searchAttribute;
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
+ var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
var time;
if (searchAttribute == nsMsgSearchAttrib.Date)
time = datePicker.value;
else
time = new Date();
// do .value instead of .setAttribute("value", xxx);
// to work around for bug #179412
// (caused by bug #157210)
@@ -2346,17 +2346,17 @@
view.toggleOpenState(i);
}
}
}
}
var index = -1;
var uri = this.parentNode.getAttribute("uri");
if (uri) {
- var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
+ var RDF = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
index = view.getIndexOfResource(RDF.GetResource(uri));
}
view.selection.select(index);
return index;
]]>
</body>
</method>
<constructor>
@@ -2449,43 +2449,43 @@
<method name="parseFolder">
<parameter name="aFolder"/>
<parameter name="aUrlListener"/>
<parameter name="aOutAsync"/>
<body>
<![CDATA[
// skip servers, Trash, Junk folders and newsgroups
if (!aFolder || aFolder.isServer || !aFolder.hasNewMessages ||
- aFolder.getFlag(Components.interfaces.nsMsgFolderFlags.Junk) ||
- aFolder.getFlag(Components.interfaces.nsMsgFolderFlags.Trash) ||
- (aFolder.server instanceof Components.interfaces.nsINntpIncomingServer))
+ aFolder.getFlag(Ci.nsMsgFolderFlags.Junk) ||
+ aFolder.getFlag(Ci.nsMsgFolderFlags.Trash) ||
+ (aFolder.server instanceof Ci.nsINntpIncomingServer))
return false;
var showPreviewText = this.Services.prefs.getBoolPref("mail.biff.alert.show_preview");
let folderArray = [];
let msgDatabase;
try {
msgDatabase = aFolder.msgDatabase;
} catch(e) {
// The database for this folder may be missing (e.g. outdated/missing .msf),
// so just skip this folder.
return false;
}
- if (aFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual)
+ if (aFolder.flags & Ci.nsMsgFolderFlags.Virtual)
{
let dbFolderInfo = msgDatabase.dBFolderInfo;
var srchFolderUri = dbFolderInfo.getCharProperty("searchFolderUri");
var srchFolderUriArray = srchFolderUri.split('|');
var foldersAdded = 0;
- var RDF = Components.classes['@mozilla.org/rdf/rdf-service;1']
- .getService(Components.interfaces.nsIRDFService);
+ var RDF = Cc['@mozilla.org/rdf/rdf-service;1']
+ .getService(Ci.nsIRDFService);
for (var i in srchFolderUriArray)
{
var realFolder = RDF.GetResource(srchFolderUriArray[i])
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
if (!realFolder.isServer)
folderArray[foldersAdded++] = realFolder;
}
}
else {
folderArray[0] = aFolder;
}
@@ -2527,18 +2527,18 @@
}
}
// if fetching the preview text is going to be an asynch operation and the caller
// is set up to handle that fact, then don't bother filling in any of the fields since
// we'll have to do this all over again when the fetch for the preview text completes.
// We don't expect to get called with a urlListener if we're doing a virtual folder.
if (aOutAsync.value && aUrlListener)
return false;
- var unicodeConverter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
- .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+ var unicodeConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+ .createInstance(Ci.nsIScriptableUnicodeConverter);
unicodeConverter.charset = "UTF-8";
foundNewMsg = true;
var index = 0;
while (document.getAnonymousNodes(this)[0].childNodes.length < this.mMaxMsgHdrsInPopup && index < numMsgKeys.value)
{
var msgPopup = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "folderSummaryMessage");
var msgHdr = msgDatabase.GetMsgHdrForKey(msgKeys.value[index++]);
@@ -2600,18 +2600,18 @@
loc.setAttribute("location", aFolder.server.prettyName + " - " + midPath + aFolder.name);
document.getAnonymousNodes(this)[0].appendChild(loc);
return true;
}
// If folder name is cropped or is a newsgroup and abbreviated per
// pref, use the full name as a tooltip.
if (aCropped ||
- ((aFolder.server instanceof Components.interfaces.nsINntpIncomingServer) &&
- !(aFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual) &&
+ ((aFolder.server instanceof Ci.nsINntpIncomingServer) &&
+ !(aFolder.flags & Ci.nsMsgFolderFlags.Virtual) &&
aFolder.server.abbreviate) && !aFolder.isServer) {
let loc = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "folderSummaryLocation");
loc.setAttribute("location", aFolder.name);
document.getAnonymousNodes(this)[0].appendChild(loc);
return true;
}
return false;
--- a/mail/base/content/mailWindow.js
+++ b/mail/base/content/mailWindow.js
@@ -34,28 +34,28 @@ function OnMailWindowUnload()
// all dbview closing is handled by OnUnloadMessenger for the 3-pane (it closes
// the tabs which close their views) and OnUnloadMessageWindow for the
// standalone message window.
MailServices.mailSession.RemoveMsgWindow(msgWindow);
// the tabs have the FolderDisplayWidget close their 'messenger' instances for us
- window.QueryInterface(Components.interfaces.nsIDOMChromeWindow)
+ window.QueryInterface(Ci.nsIDOMChromeWindow)
.browserDOMWindow = null;
msgWindow.closeWindow();
msgWindow.msgHeaderSink = null;
msgWindow.notificationCallbacks = null;
gDBView = null;
window.MsgStatusFeedback.unload();
- Components.classes["@mozilla.org/activity-manager;1"]
- .getService(Components.interfaces.nsIActivityManager)
- .removeListener(window.MsgStatusFeedback);
+ Cc["@mozilla.org/activity-manager;1"]
+ .getService(Ci.nsIActivityManager)
+ .removeListener(window.MsgStatusFeedback);
}
/**
* When copying/dragging, convert imap/mailbox URLs of images into data URLs so
* that the images can be accessed in a paste elsewhere.
*/
function onCopyOrDragStart(e) {
@@ -121,65 +121,65 @@ function onCopyOrDragStart(e) {
for (let img of images) {
if (!imgMap.has(img.src)) {
continue;
}
img.src = imgMap.get(img.src);
}
let html = div.innerHTML;
- let parserUtils = Components.classes["@mozilla.org/parserutils;1"]
- .getService(Components.interfaces.nsIParserUtils);
+ let parserUtils = Cc["@mozilla.org/parserutils;1"]
+ .getService(Ci.nsIParserUtils);
let plain = parserUtils.convertToPlainText(html,
- Components.interfaces.nsIDocumentEncoder.OutputForPlainTextClipboardCopy, 0);
+ Ci.nsIDocumentEncoder.OutputForPlainTextClipboardCopy, 0);
if ("clipboardData" in e) { // copy
e.clipboardData.setData("text/html", html);
e.clipboardData.setData("text/plain", plain);
e.preventDefault();
}
else if ("dataTransfer" in e) { // drag
e.dataTransfer.setData("text/html", html);
e.dataTransfer.setData("text/plain", plain);
}
}
function CreateMailWindowGlobals()
{
// get the messenger instance
- messenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ messenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
window.addEventListener("blur", appIdleManager.onBlur);
window.addEventListener("focus", appIdleManager.onFocus);
//Create windows status feedback
// set the JS implementation of status feedback before creating the c++ one..
window.MsgStatusFeedback = new nsMsgStatusFeedback();
// double register the status feedback object as the xul browser window implementation
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem).treeOwner
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIXULWindow)
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem).treeOwner
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIXULWindow)
.XULBrowserWindow = window.MsgStatusFeedback;
- window.QueryInterface(Components.interfaces.nsIDOMChromeWindow)
+ window.QueryInterface(Ci.nsIDOMChromeWindow)
.browserDOMWindow = new nsBrowserAccess();
- statusFeedback = Components.classes["@mozilla.org/messenger/statusfeedback;1"]
- .createInstance(Components.interfaces.nsIMsgStatusFeedback);
+ statusFeedback = Cc["@mozilla.org/messenger/statusfeedback;1"]
+ .createInstance(Ci.nsIMsgStatusFeedback);
statusFeedback.setWrappedStatusFeedback(window.MsgStatusFeedback);
- Components.classes["@mozilla.org/activity-manager;1"]
- .getService(Components.interfaces.nsIActivityManager)
- .addListener(window.MsgStatusFeedback);
+ Cc["@mozilla.org/activity-manager;1"]
+ .getService(Ci.nsIActivityManager)
+ .addListener(window.MsgStatusFeedback);
//Create message window object
- msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
+ msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
+ .createInstance(Ci.nsIMsgWindow);
accountManager = MailServices.accounts;
msgWindow.notificationCallbacks = new BadCertHandler();
}
function InitMsgWindow()
{
@@ -188,17 +188,17 @@ function InitMsgWindow()
msgWindow.domWindow = window;
msgWindow.statusFeedback = statusFeedback;
msgWindow.msgHeaderSink = messageHeaderSink;
MailServices.mailSession.AddMsgWindow(msgWindow);
let messagepane = document.getElementById("messagepane");
messagepane.docShell.allowAuth = false;
messagepane.docShell.allowDNSPrefetch = false;
msgWindow.rootDocShell.allowAuth = true;
- msgWindow.rootDocShell.appType = Components.interfaces.nsIDocShell.APP_TYPE_MAIL;
+ msgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
// Ensure we don't load xul error pages into the main window
msgWindow.rootDocShell.useErrorPages = false;
document.addEventListener("copy", onCopyOrDragStart, true);
document.addEventListener("dragstart", onCopyOrDragStart, true);
}
// We're going to implement our status feedback for the mail window in JS now.
@@ -261,24 +261,24 @@ nsMsgStatusFeedback.prototype =
},
// Called before links are navigated to to allow us to retarget them if needed.
onBeforeLinkTraversal: function(originalTarget, linkURI, linkNode, isAppTab) {
return originalTarget;
},
QueryInterface: function(iid) {
- if (iid.equals(Components.interfaces.nsIMsgStatusFeedback) ||
- iid.equals(Components.interfaces.nsIXULBrowserWindow) ||
- iid.equals(Components.interfaces.nsIActivityMgrListener) ||
- iid.equals(Components.interfaces.nsIActivityListener) ||
- iid.equals(Components.interfaces.nsISupportsWeakReference) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIMsgStatusFeedback) ||
+ iid.equals(Ci.nsIXULBrowserWindow) ||
+ iid.equals(Ci.nsIActivityMgrListener) ||
+ iid.equals(Ci.nsIActivityListener) ||
+ iid.equals(Ci.nsISupportsWeakReference) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
// nsIMsgStatusFeedback implementation.
showStatusString: function(statusText) {
if (!statusText)
statusText = this._defaultStatusText;
else
this._defaultStatusText = "";
@@ -374,17 +374,17 @@ nsMsgStatusFeedback.prototype =
// processes running at the same time.
let currentProgress = 0;
let progressCount = 0;
// For each activity that is in progress, get its status.
this._activeProcesses.forEach(function (element) {
if (element.state ==
- Components.interfaces.nsIActivityProcess.STATE_INPROGRESS &&
+ Ci.nsIActivityProcess.STATE_INPROGRESS &&
element.percentComplete != -1) {
currentProgress += element.percentComplete;
++progressCount;
}
});
// Add the generic progress that's fed to the status feedback object if
// we've got one.
@@ -423,20 +423,20 @@ nsMsgStatusFeedback.prototype =
}
},
// nsIActivityMgrListener
onAddedActivity: function(aID, aActivity) {
// ignore Gloda activity for status bar purposes
if (aActivity.initiator == Gloda)
return;
- if (aActivity instanceof Components.interfaces.nsIActivityEvent) {
+ if (aActivity instanceof Ci.nsIActivityEvent) {
this.showStatusString(aActivity.displayText);
}
- else if (aActivity instanceof Components.interfaces.nsIActivityProcess) {
+ else if (aActivity instanceof Ci.nsIActivityProcess) {
this._activeProcesses.push(aActivity);
aActivity.addListener(this);
this.startMeteors();
}
},
onRemovedActivity: function(aID) {
this._activeProcesses =
@@ -457,17 +457,17 @@ nsMsgStatusFeedback.prototype =
onProgressChanged: function(aActivity, aStatusText, aWorkUnitsCompleted,
aTotalWorkUnits) {
let index = this._activeProcesses.indexOf(aActivity);
// Iterate through the list trying to find the first active process, but
// only go as far as our process.
for (var i = 0; i < index; ++i) {
if (this._activeProcesses[i].status ==
- Components.interfaces.nsIActivityProcess.STATE_INPROGRESS)
+ Ci.nsIActivityProcess.STATE_INPROGRESS)
break;
}
// If the found activity was the same as our activity, update the status
// text.
if (i == index)
// Use the display text if we haven't got any status text. I'm assuming
// that the status text will be generally what we want to see on the
@@ -485,20 +485,20 @@ nsMsgStatusFeedback.prototype =
function nsMsgWindowCommands()
{
}
nsMsgWindowCommands.prototype =
{
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIMsgWindowCommands) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIMsgWindowCommands) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
selectFolder: function(folderUri)
{
gFolderTreeView.selectFolder(MailUtils.getFolderForURI(folderUri));
},
selectMessage: function(messageUri)
@@ -530,17 +530,17 @@ function loadStartPage(aForce)
let startpage = Services.urlFormatter.formatURLPref("mailnews.start_page.url");
if (startpage)
{
try {
let uri = Services.uriFixup.createFixupURI(startpage, 0);
GetMessagePaneFrame().location.href = uri.spec;
}
catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
else
{
GetMessagePaneFrame().location.href = "about:blank";
}
}
@@ -619,20 +619,20 @@ BadCertHandler.prototype = {
// nsIInterfaceRequestor
getInterface: function(iid) {
return this.QueryInterface(iid);
},
// nsISupports
QueryInterface: function(iid) {
- if (!iid.equals(Components.interfaces.nsIBadCertListener2) &&
- !iid.equals(Components.interfaces.nsIInterfaceRequestor) &&
- !iid.equals(Components.interfaces.nsISupports))
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ if (!iid.equals(Ci.nsIBadCertListener2) &&
+ !iid.equals(Ci.nsIInterfaceRequestor) &&
+ !iid.equals(Ci.nsISupports))
+ throw Cr.NS_ERROR_NO_INTERFACE;
return this;
}
};
function InformUserOfCertError(socketInfo, status, targetSite)
{
let params = {
exceptionAdded : false,
@@ -642,46 +642,46 @@ function InformUserOfCertError(socketInf
};
window.openDialog('chrome://pippki/content/exceptionDialog.xul',
'','chrome,centerscreen,modal', params);
}
function nsBrowserAccess() { }
nsBrowserAccess.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIBrowserDOMWindow]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserDOMWindow]),
// The following function may be called during account creation, it is called by
// the Mozmill test test-newmailaccount.js::test_window_open_link_opening_behaviour.
createContentWindow(aURI, aOpener, aWhere, aFlags, aTriggeringPrincipal = null) {
return this.getContentWindowOrOpenURI(null, aOpener, aWhere, aFlags,
aTriggeringPrincipal);
},
openURI: function (aURI, aOpener, aWhere, aFlags, aTriggeringPrincipal = null) {
if (!aURI) {
- Components.utils.reportError("openURI should only be called with a valid URI");
- throw Components.results.NS_ERROR_FAILURE;
+ Cu.reportError("openURI should only be called with a valid URI");
+ throw Cr.NS_ERROR_FAILURE;
}
return this.getContentWindowOrOpenURI(aURI, aOpener, aWhere, aFlags,
aTriggeringPrincipal);
},
getContentWindowOrOpenURI(aURI, aOpener, aWhere, aFlags, aTriggeringPrincipal) {
- const nsIBrowserDOMWindow = Components.interfaces.nsIBrowserDOMWindow;
+ const nsIBrowserDOMWindow = Ci.nsIBrowserDOMWindow;
let isExternal = !!(aFlags & nsIBrowserDOMWindow.OPEN_EXTERNAL);
if (isExternal && aURI && aURI.schemeIs("chrome")) {
Services.console.logStringMessage("use -chrome command-line option to load external chrome urls\n");
return null;
}
let newWindow = null;
let loadflags = isExternal ?
- Components.interfaces.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
- Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
+ Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
+ Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
if (aWhere != nsIBrowserDOMWindow.OPEN_NEWTAB)
Services.console.logStringMessage("Opening a URI in something other than a new tab is not supported, opening in new tab instead");
let win, needToFocusWin;
// Try the current window. If we're in a popup, fall back on the most
// recent browser window.
@@ -704,27 +704,27 @@ nsBrowserAccess.prototype = {
if (browser)
clickHandler = browser.clickHandler;
let newTab = tabmail.openTab("contentTab", {contentPage: "about:blank",
background: loadInBackground,
clickHandler: clickHandler});
newWindow = newTab.browser.docShell
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
try {
if (aURI) {
let referrer = null;
if (aOpener) {
let location = aOpener.location;
referrer = Services.io.newURI(location);
}
- newWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
+ newWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
.loadURI(aURI.spec, loadflags, referrer, null, null, aTriggeringPrincipal);
}
if (needToFocusWin || (!loadInBackground && isExternal))
newWindow.focus();
} catch(e) {
}
return newWindow;
},
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -70,17 +70,17 @@ function menu_new_init()
let folder = gFolderDisplay.displayedFolder;
if (!folder)
return;
if (Services.prefs.prefIsLocked("mail.disable_new_account_addition"))
document.getElementById("newAccountMenuItem").setAttribute("disabled", "true");
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
var isInbox = folder.isSpecialFolder(nsMsgFolderFlags.Inbox);
var showNew = (folder.canCreateSubfolders ||
(isInbox && !(folder.flags & nsMsgFolderFlags.Virtual))) &&
(document.getElementById("cmd_newFolder").getAttribute("disabled") != "true");
ShowMenuItem("menu_newFolder", showNew);
ShowMenuItem("menu_newVirtualFolder", showNew);
EnableMenuItem("menu_newFolder", folder.server.type != "imap" || MailOfflineMgr.isOnline());
@@ -131,17 +131,17 @@ function InitEditMessagesMenu()
goSetAccessKey('cmd_delete', 'valueDefaultAccessKey');
document.commandDispatcher.updateCommands('create-menu-edit');
// initialize the favorite Folder checkbox in the edit menu
let favoriteFolderMenu = document.getElementById('menu_favoriteFolder');
if (!favoriteFolderMenu.hasAttribute("disabled")) {
let folders = gFolderTreeView.getSelectedFolders();
if (folders.length == 1 && !folders[0].isServer) {
- const kFavoriteFlag = Components.interfaces.nsMsgFolderFlags.Favorite;
+ const kFavoriteFlag = Ci.nsMsgFolderFlags.Favorite;
// Adjust the checked state on the menu item.
favoriteFolderMenu.setAttribute("checked", folders[0].getFlag(kFavoriteFlag));
favoriteFolderMenu.hidden = false;
} else {
favoriteFolderMenu.hidden = true;
}
}
}
@@ -152,17 +152,17 @@ function InitAppFolderViewsMenu()
goSetAccessKey('cmd_delete', 'valueDefaultAccessKey');
document.commandDispatcher.updateCommands('create-menu-edit');
// initialize the favorite Folder checkbox in the appmenu menu
let favoriteAppFolderMenu = document.getElementById('appmenu_favoriteFolder');
if (!favoriteAppFolderMenu.hasAttribute("disabled")) {
let folders = gFolderTreeView.getSelectedFolders();
if (folders.length == 1 && !folders[0].isServer) {
- const kFavoriteFlag = Components.interfaces.nsMsgFolderFlags.Favorite;
+ const kFavoriteFlag = Ci.nsMsgFolderFlags.Favorite;
// Adjust the checked state on the menu item.
favoriteAppFolderMenu.setAttribute("checked", folders[0].getFlag(kFavoriteFlag));
favoriteAppFolderMenu.hidden = false;
} else {
favoriteAppFolderMenu.hidden = true;
}
}
}
@@ -487,21 +487,21 @@ function InitMessageMenu()
document.getElementById("forwardAsMenu").disabled = !selectedMsg;
// Disable the Tag menu item if no message is selected or when we're
// not in a folder.
document.getElementById("tagMenu").disabled = !messageStoredInternally;
// Show "Edit Draft Message" menus only in a drafts folder; otherwise hide them.
showCommandInSpecialFolder("cmd_editDraftMsg",
- Components.interfaces.nsMsgFolderFlags.Drafts);
+ Ci.nsMsgFolderFlags.Drafts);
// Show "New Message from Template" and "Edit Template" menus only in a
// templates folder; otherwise hide them.
showCommandInSpecialFolder(["cmd_newMsgFromTemplate", "cmd_editTemplateMsg"],
- Components.interfaces.nsMsgFolderFlags.Templates);
+ Ci.nsMsgFolderFlags.Templates);
// Initialize the Open Message menuitem
var winType = document.documentElement.getAttribute('windowtype');
if (winType == "mail:3pane")
document.getElementById('openMessageWindowMenuitem').hidden = isFeed;
// Initialize the Open Feed Message handler menu
let index = FeedMessageHandler.onOpenPref;
@@ -553,21 +553,21 @@ function InitAppMessageMenu()
document.getElementById("appmenu_forwardAsMenu").disabled = !selectedMsg;
// Disable the Tag menu item if no message is selected or when we're
// not in a folder.
document.getElementById("appmenu_tagMenu").disabled = !messageStoredInternally;
// Show "Edit Draft Message" menus only in a drafts folder; otherwise hide them.
showCommandInSpecialFolder("cmd_editDraftMsg",
- Components.interfaces.nsMsgFolderFlags.Drafts);
+ Ci.nsMsgFolderFlags.Drafts);
// Show "New Message from Template" and "Edit Template" menus only in a
// templates folder; otherwise hide them.
showCommandInSpecialFolder(["cmd_newMsgFromTemplate", "cmd_editTemplateMsg"],
- Components.interfaces.nsMsgFolderFlags.Templates);
+ Ci.nsMsgFolderFlags.Templates);
// Initialize the Open Message menuitem
let winType = document.documentElement.getAttribute('windowtype');
if (winType == "mail:3pane")
document.getElementById('appmenu_openMessageWindowMenuitem').hidden = isFeed;
// Initialize the Open Feed Message handler menu
let index = FeedMessageHandler.onOpenPref;
@@ -630,31 +630,31 @@ function initMoveToFolderAgainMenu(aMenu
[destMsgFolder.prettyName], 1);
// This gives us moveToFolderAgainAccessKey and copyToFolderAgainAccessKey.
aMenuItem.accesskey = bundle.getString(stringName + "AccessKey");
}
}
function InitViewHeadersMenu()
{
- const dt = Components.interfaces.nsMimeHeaderDisplayTypes;
+ const dt = Ci.nsMimeHeaderDisplayTypes;
var headerchoice = Services.prefs.getIntPref("mail.show_headers");
document.getElementById("cmd_viewAllHeader")
.setAttribute("checked", headerchoice == dt.AllHeaders);
document.getElementById("cmd_viewNormalHeader")
.setAttribute("checked", headerchoice == dt.NormalHeaders);
document.commandDispatcher.updateCommands("create-menu-mark");
}
/**
* @param headermode {Ci.nsMimeHeaderDisplayTypes}
*/
function AdjustHeaderView(headermode)
{
- const all = Components.interfaces.nsMimeHeaderDisplayTypes.AllHeaders;
+ const all = Ci.nsMimeHeaderDisplayTypes.AllHeaders;
document.getElementById("expandedHeaderView")
.setAttribute("show_header_mode", headermode == all ? "all" : "normal");
}
function InitViewBodyMenu()
{
// Separate render prefs not implemented for feeds, bug 458606. Show the
@@ -827,18 +827,18 @@ function SetGetMsgButtonTooltip()
}
function RemoveAllMessageTags()
{
var selectedMessages = gFolderDisplay.selectedMessages;
if (!selectedMessages.length)
return;
- var messages = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var messages = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
let tagArray = MailServices.tags.getAllTags({});
var allKeys = "";
for (var j = 0; j < tagArray.length; ++j)
{
if (j)
allKeys += " ";
allKeys += tagArray[j].key;
@@ -899,20 +899,20 @@ function ToggleMessageTagMenu(target)
{
var key = target.getAttribute("value");
var addKey = target.getAttribute("checked") == "true";
ToggleMessageTag(key, addKey);
}
function ToggleMessageTag(key, addKey)
{
- var messages = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
- var msg = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var messages = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
+ var msg = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
var selectedMessages = gFolderDisplay.selectedMessages;
var toggler = addKey ? "addKeywordsToMessages" : "removeKeywordsFromMessages";
var prevHdrFolder = null;
// this crudely handles cross-folder virtual folders with selected messages
// that spans folders, by coalescing consecutive msgs in the selection
// that happen to be in the same folder. nsMsgSearchDBView does this
// better, but nsIMsgDBView doesn't handle commands with arguments,
// and (un)tag takes a key argument.
@@ -1135,17 +1135,17 @@ function populateHistoryMenu(menuPopup,
// virtual folders because 'folder' is the display folder, not the
// underlying one.
if (folder != gFolderDisplay.displayedFolder)
menuText = folder.prettyName + " - ";
var msgHdr = messenger.msgHdrFromURI(historyArray[i]);
var subject = "";
- if (msgHdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe)
+ if (msgHdr.flags & Ci.nsMsgMessageFlags.HasRe)
subject = "Re: ";
if (msgHdr.mime2DecodedSubject)
subject += msgHdr.mime2DecodedSubject;
if (subject)
menuText += subject + " - ";
menuText += msgHdr.mime2DecodedAuthor;
newMenuItem = document.createElement('menuitem');
@@ -1377,17 +1377,17 @@ function UpdateDeleteCommand()
goSetAccessKey("cmd_delete", value + "AccessKey");
}
function SelectedMessagesAreDeleted()
{
let firstSelectedMessage = gFolderDisplay.selectedMessage;
return firstSelectedMessage &&
(firstSelectedMessage.flags &
- Components.interfaces.nsMsgMessageFlags.IMAPDeleted);
+ Ci.nsMsgMessageFlags.IMAPDeleted);
}
function SelectedMessagesAreJunk()
{
try {
var junkScore = gFolderDisplay.selectedMessage.getStringProperty("junkscore");
return (junkScore != "") && (junkScore != "0");
}
@@ -1425,17 +1425,17 @@ function GetFirstSelectedMsgFolder()
}
function GetInboxFolder(server)
{
try {
var rootMsgFolder = server.rootMsgFolder;
// Now find the Inbox.
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
return rootMsgFolder.getFolderWithFlags(nsMsgFolderFlags.Inbox);
}
catch (ex) {
dump(ex + "\n");
}
return null;
}
@@ -1480,31 +1480,31 @@ function MsgGetMessagesForAllServers(def
var allServers = accountManager.allServers;
// Array of arrays of servers for a particular folder.
var pop3DownloadServersArray = [];
// Parallel array of folders to download to...
var localFoldersToDownloadTo = [];
var pop3Server;
for (var i = 0; i < allServers.length; ++i)
{
- var currentServer = allServers.queryElementAt(i, Components.interfaces.nsIMsgIncomingServer);
+ var currentServer = allServers.queryElementAt(i, Ci.nsIMsgIncomingServer);
if (currentServer.protocolInfo.canLoginAtStartUp &&
currentServer.loginAtStartUp)
{
if (defaultServer && defaultServer.equals(currentServer) &&
!defaultServer.isDeferredTo &&
defaultServer.rootFolder == defaultServer.rootMsgFolder)
{
// skip, already opened
}
else if (currentServer.type == "pop3" && currentServer.downloadOnBiff)
{
CoalesceGetMsgsForPop3ServersByDestFolder(currentServer,
pop3DownloadServersArray, localFoldersToDownloadTo);
- pop3Server = currentServer.QueryInterface(Components.interfaces.nsIPop3IncomingServer);
+ pop3Server = currentServer.QueryInterface(Ci.nsIPop3IncomingServer);
}
else
{
// Check to see if there are new messages on the server
currentServer.performBiff(msgWindow);
}
}
}
@@ -1580,20 +1580,19 @@ function MsgDeleteMessage(reallyDelete,
/**
* Copies the selected messages to the destination folder
* @param aDestFolder the destination folder
*/
function MsgCopyMessage(aDestFolder)
{
if (gMessageDisplay.isDummy) {
- let file = window.arguments[0].QueryInterface(Components.interfaces
- .nsIFileURL).file;
+ let file = window.arguments[0].QueryInterface(Ci.nsIFileURL).file;
MailServices.copy.CopyFileMessage(file, aDestFolder, null, false,
- Components.interfaces.nsMsgMessageFlags.Read,
+ Ci.nsMsgMessageFlags.Read,
"", null, msgWindow);
}
else
gDBView.doCommandWithFolder(nsMsgViewCommandType.copyMessages, aDestFolder);
Services.prefs.setCharPref("mail.last_msg_movecopy_target_uri", aDestFolder.URI);
Services.prefs.setBoolPref("mail.last_msg_movecopy_was_move", false);
}
@@ -1620,28 +1619,28 @@ function MsgMoveMessage(aDestFolder)
function composeMsgByType(aCompType, aEvent) {
// If we're the hidden window, then we're not going to have a gFolderDisplay
// to work out existing folders, so just use null.
let msgFolder = gFolderDisplay ? GetFirstSelectedMsgFolder() : null;
let msgUris = gFolderDisplay ? gFolderDisplay.selectedMessageUris : null;
if (aEvent && aEvent.shiftKey) {
ComposeMessage(aCompType,
- Components.interfaces.nsIMsgCompFormat.OppositeOfDefault,
+ Ci.nsIMsgCompFormat.OppositeOfDefault,
msgFolder, msgUris);
}
else {
- ComposeMessage(aCompType, Components.interfaces.nsIMsgCompFormat.Default,
+ ComposeMessage(aCompType, Ci.nsIMsgCompFormat.Default,
msgFolder, msgUris);
}
}
function MsgNewMessage(event)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.New, event);
+ composeMsgByType(Ci.nsIMsgCompType.New, event);
}
function CanComposeMessages()
{
return MailServices.accounts.allIdentities.length > 0;
}
function MsgReplyMessage(event)
@@ -1649,32 +1648,32 @@ function MsgReplyMessage(event)
if (gFolderDisplay.selectedMessageIsNews)
MsgReplyGroup(event);
else
MsgReplySender(event);
}
function MsgReplySender(event)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.ReplyToSender, event);
+ composeMsgByType(Ci.nsIMsgCompType.ReplyToSender, event);
}
function MsgReplyGroup(event)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.ReplyToGroup, event);
+ composeMsgByType(Ci.nsIMsgCompType.ReplyToGroup, event);
}
function MsgReplyToAllMessage(event)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.ReplyAll, event);
+ composeMsgByType(Ci.nsIMsgCompType.ReplyAll, event);
}
function MsgReplyToListMessage(event)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.ReplyToList, event);
+ composeMsgByType(Ci.nsIMsgCompType.ReplyToList, event);
}
// Message Archive function
function BatchMessageMover() {
this._batches = {};
this._currentKey = null;
this._dstFolderParent = null;
@@ -1728,22 +1727,22 @@ BatchMessageMover.prototype = {
continue;
archiveFolderURI = identity.archiveFolder;
archiveGranularity = identity.archiveGranularity;
archiveKeepFolderStructure = identity.archiveKeepFolderStructure;
}
let copyBatchKey = msgHdr.folder.URI;
- if (archiveGranularity >= Components.interfaces.nsIMsgIdentity
- .perYearArchiveFolders)
+ if (archiveGranularity >= Ci.nsIMsgIdentity
+ .perYearArchiveFolders)
copyBatchKey += '\0' + msgYear;
- if (archiveGranularity >= Components.interfaces.nsIMsgIdentity
- .perMonthArchiveFolders)
+ if (archiveGranularity >= Ci.nsIMsgIdentity
+ .perMonthArchiveFolders)
copyBatchKey += '\0' + monthFolderName;
if (archiveKeepFolderStructure)
copyBatchKey += msgHdr.folder.URI;
// Add a key to copyBatchKey
if (!(copyBatchKey in this._batches)) {
this._batches[copyBatchKey] = {
@@ -1776,55 +1775,55 @@ BatchMessageMover.prototype = {
MailServices.mfn.removeListener(this);
// all done
return;
},
filterBatch: function () {
let batch = this._currentBatch;
- let filterArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let filterArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
for (let message of batch.messages) {
filterArray.appendElement(message);
}
// Apply filters to this batch.
MailServices.filters.applyFilters(
- Components.interfaces.nsMsgFilterType.Archive,
+ Ci.nsMsgFilterType.Archive,
filterArray, batch.srcFolder, msgWindow, this);
return; // continues with onStopOperation
},
onStopOperation: function (aResult) {
if (!Components.isSuccessCode(aResult))
{
- Components.utils.reportError("Archive filter failed: " + aResult);
+ Cu.reportError("Archive filter failed: " + aResult);
// We don't want to effectively disable archiving because a filter
// failed, so we'll continue after reporting the error.
}
// Now do the default archive processing
this.continueBatch();
},
// continue processing of default archive operations
continueBatch: function () {
let batch = this._currentBatch;
let srcFolder = batch.srcFolder;
let archiveFolderURI = batch.archiveFolderURI;
let archiveFolder = MailUtils.getFolderForURI(archiveFolderURI, false);
let dstFolder = archiveFolder;
- let moveArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Ci.nsIMutableArray);
+ let moveArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
// Don't move any items that the filter moves or deleted
for (let item of batch.messages) {
if (srcFolder.msgDatabase.ContainsKey(item.messageKey) &&
!(srcFolder.getProcessingFlags(item.messageKey) &
- Components.interfaces.nsMsgProcessingFlags.FilterToMove)) {
+ Ci.nsMsgProcessingFlags.FilterToMove)) {
moveArray.appendElement(item);
}
}
if (moveArray.length == 0)
return this.processNextBatch(); // continue processing
// For folders on some servers (e.g. IMAP), we need to create the
@@ -1911,34 +1910,34 @@ BatchMessageMover.prototype = {
},
OnStartRunningUrl: function(url) {},
OnStopRunningUrl: function(url, exitCode) {
// this will always be a create folder url, afaik.
if (Components.isSuccessCode(exitCode))
this.continueBatch();
else {
- Components.utils.reportError("Archive failed to create folder: " + exitCode);
+ Cu.reportError("Archive failed to create folder: " + exitCode);
this._batches = null;
this.processNextBatch(); // for cleanup and exit
}
},
// also implements nsIMsgCopyServiceListener, but we only care
// about the OnStopCopy
OnStartCopy: function() {},
OnProgress: function(aProgress, aProgressMax) {},
SetMessageKey: function(aKey) {},
GetMessageId: function() {},
OnStopCopy: function(aStatus) {
if (Components.isSuccessCode(aStatus))
return this.processNextBatch();
// stop on error
- Components.utils.reportError("Archive failed to copy: " + aStatus);
+ Cu.reportError("Archive failed to copy: " + aStatus);
this._batches = null;
this.processNextBatch(); // for cleanup and exit
},
// This also implements nsIMsgFolderListener, but we only care about the
// folderAdded (createSubfolder callback).
folderAdded: function(aFolder) {
// Check that this is the folder we're interested in.
@@ -1946,21 +1945,21 @@ BatchMessageMover.prototype = {
aFolder.name == this._dstFolderName) {
this._dstFolderParent = null;
this._dstFolderName = null;
this.continueBatch();
}
},
QueryInterface: function(iid) {
- if (!iid.equals(Components.interfaces.nsIUrlListener) &&
- !iid.equals(Components.interfaces.nsIMsgCopyServiceListener) &&
- !iid.equals(Components.interfaces.nsIMsgOperationListener) &&
- !iid.equals(Components.interfaces.nsISupports))
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ if (!iid.equals(Ci.nsIUrlListener) &&
+ !iid.equals(Ci.nsIMsgCopyServiceListener) &&
+ !iid.equals(Ci.nsIMsgOperationListener) &&
+ !iid.equals(Ci.nsISupports))
+ throw Cr.NS_ERROR_NO_INTERFACE;
return this;
}
}
/**
* Archives the selected messages
*
* @param event the event that caused us to call this function
@@ -1987,48 +1986,48 @@ function MsgForwardMessage(event)
if (forwardType == 0)
MsgForwardAsAttachment(event);
else
MsgForwardAsInline(event);
}
function MsgForwardAsAttachment(event)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.ForwardAsAttachment, event);
+ composeMsgByType(Ci.nsIMsgCompType.ForwardAsAttachment, event);
}
function MsgForwardAsInline(event)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.ForwardInline, event);
+ composeMsgByType(Ci.nsIMsgCompType.ForwardInline, event);
}
function MsgEditMessageAsNew(aEvent)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.EditAsNew, aEvent);
+ composeMsgByType(Ci.nsIMsgCompType.EditAsNew, aEvent);
}
function MsgEditDraftMessage(aEvent)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.Draft, aEvent);
+ composeMsgByType(Ci.nsIMsgCompType.Draft, aEvent);
}
function MsgNewMessageFromTemplate(aEvent)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.Template, aEvent);
+ composeMsgByType(Ci.nsIMsgCompType.Template, aEvent);
}
function MsgEditTemplateMessage(aEvent)
{
- composeMsgByType(Components.interfaces.nsIMsgCompType.EditTemplate, aEvent);
+ composeMsgByType(Ci.nsIMsgCompType.EditTemplate, aEvent);
}
function MsgComposeDraftMessage()
{
- ComposeMessage(Components.interfaces.nsIMsgCompType.Draft,
- Components.interfaces.nsIMsgCompFormat.Default,
+ ComposeMessage(Ci.nsIMsgCompType.Draft,
+ Ci.nsIMsgCompFormat.Default,
gFolderDisplay.displayedFolder,
gFolderDisplay.selectedMessageUris);
}
function MsgCreateFilter()
{
// retrieve Sender direct from selected message's headers
var msgHdr = gFolderDisplay.selectedMessage;
@@ -2048,17 +2047,17 @@ function MsgNewFolder(callBackFunctionNa
{
try {
server = preselectedFolder.server;
if (server)
{
destinationFolder = getDestinationFolder(preselectedFolder, server);
var imapServer =
- server.QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ server.QueryInterface(Ci.nsIImapIncomingServer);
if (imapServer)
dualUseFolders = imapServer.dualUseFolders;
}
} catch (e) {
dump ("Exception: dualUseFolders = true\n");
}
}
window.openDialog("chrome://messenger/content/newFolderDialog.xul", "",
@@ -2138,26 +2137,26 @@ function ConfirmUnsubscribe(folders)
function MsgUnsubscribe(newsgroups)
{
var folders = newsgroups || gFolderTreeView.getSelectedFolders();
if (!ConfirmUnsubscribe(folders))
return;
for (let i = 0; i < folders.length; i++) {
let subscribableServer = folders[i].server.QueryInterface(
- Components.interfaces.nsISubscribableServer);
+ Ci.nsISubscribableServer);
subscribableServer.unsubscribe(folders[i].name);
subscribableServer.commitSubscribeChanges();
}
}
function ToggleFavoriteFolderFlag()
{
var folder = GetFirstSelectedMsgFolder();
- folder.toggleFlag(Components.interfaces.nsMsgFolderFlags.Favorite);
+ folder.toggleFlag(Ci.nsMsgFolderFlags.Favorite);
}
function MsgSaveAsFile()
{
SaveAsFile(gFolderDisplay.selectedMessageUris);
}
function MsgSaveAsTemplate()
@@ -2246,35 +2245,35 @@ function MsgOpenSelectedMessages()
// displayMessages would look for a 3pane window and open tabs there.
MailUtils.displayMessages(gFolderDisplay.selectedMessages,
gFolderDisplay.view,
document.getElementById("tabmail"));
}
function MsgOpenFromFile()
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
var bundle = document.getElementById("bundle_messenger");
var filterLabel = bundle.getString("EMLFiles");
var windowTitle = bundle.getString("OpenEMLFiles");
fp.init(window, windowTitle, nsIFilePicker.modeOpen);
fp.appendFilter(filterLabel, "*.eml");
// Default or last filter is "All Files".
fp.appendFilters(nsIFilePicker.filterAll);
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.file) {
return;
}
- let uri = fp.fileURL.QueryInterface(Components.interfaces.nsIURL);
+ let uri = fp.fileURL.QueryInterface(Ci.nsIURL);
uri.query = "type=application/x-message-display";
window.openDialog("chrome://messenger/content/messageWindow.xul", "_blank",
"all,chrome,dialog=no,status,toolbar", uri);
});
}
function MsgOpenNewWindowForMessage(aMsgHdr)
@@ -2346,17 +2345,17 @@ function UpdateJunkButton()
{
// The junk message should slave off the selected message, as the preview pane
// may not be visible
let hdr = gFolderDisplay.selectedMessage;
// But only the message display knows if we are dealing with a dummy.
if (!hdr || gMessageDisplay.isDummy) // .eml file
return;
let junkScore = hdr.getStringProperty("junkscore");
- let hideJunk = (junkScore == Components.interfaces.nsIJunkMailPlugin.IS_SPAM_SCORE);
+ let hideJunk = (junkScore == Ci.nsIJunkMailPlugin.IS_SPAM_SCORE);
if (!gFolderDisplay.getCommandStatus(nsMsgViewCommandType.junk))
hideJunk = true;
if (document.getElementById('hdrJunkButton')) {
document.getElementById('hdrJunkButton').disabled = hideJunk;
}
}
/**
@@ -2466,18 +2465,18 @@ function MsgFilters(emailAddress, folder
args = { refresh: false, folder: folder };
MsgFilterList(args);
}
}
function MsgApplyFilters()
{
let preselectedFolder = GetFirstSelectedMsgFolder();
- let selectedFolders = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let selectedFolders = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
selectedFolders.appendElement(preselectedFolder);
let curFilterList = preselectedFolder.getFilterList(msgWindow);
// create a new filter list and copy over the enabled filters to it.
// We do this instead of having the filter after the fact code ignore
// disabled filters because the Filter Dialog filter after the fact
// code would have to clone filters to allow disabled filters to run,
// and we don't support cloning filters currently.
@@ -2487,36 +2486,36 @@ function MsgApplyFilters()
tempFilterList.logStream = curFilterList.logStream;
tempFilterList.loggingEnabled = curFilterList.loggingEnabled;
let newFilterIndex = 0;
for (let i = 0; i < numFilters; i++)
{
let curFilter = curFilterList.getFilterAt(i);
// only add enabled, UI visibile filters that are in the manual context
if (curFilter.enabled && !curFilter.temporary &&
- (curFilter.filterType & Components.interfaces.nsMsgFilterType.Manual))
+ (curFilter.filterType & Ci.nsMsgFilterType.Manual))
{
tempFilterList.insertFilterAt(newFilterIndex, curFilter);
newFilterIndex++;
}
}
MailServices.filters.applyFiltersToFolders(tempFilterList, selectedFolders, msgWindow);
}
function MsgApplyFiltersToSelection()
{
// bail if we're dealing with a dummy header
if (gMessageDisplay.isDummy)
return;
var selectedMessages = gFolderDisplay.selectedMessages;
if (selectedMessages.length) {
- MailServices.filters.applyFilters(Components.interfaces.nsMsgFilterType.Manual,
+ MailServices.filters.applyFilters(Ci.nsMsgFilterType.Manual,
toXPCOMArray(selectedMessages,
- Components.interfaces.nsIMutableArray),
+ Ci.nsIMutableArray),
gFolderDisplay.displayedFolder,
msgWindow);
}
}
function ChangeMailLayout(newLayout)
{
Services.prefs.setIntPref("mail.pane_config.dynamic", newLayout);
@@ -2524,25 +2523,25 @@ function ChangeMailLayout(newLayout)
function ChangeMailLayoutForCommand(aCommand)
{
ChangeMailLayout(kMailLayoutCommandMap[aCommand]);
}
function MsgViewAllHeaders()
{
- const mode = Components.interfaces.nsMimeHeaderDisplayTypes.AllHeaders;
+ const mode = Ci.nsMimeHeaderDisplayTypes.AllHeaders;
Services.prefs.setIntPref("mail.show_headers", mode); // 2
AdjustHeaderView(mode);
ReloadMessage();
}
function MsgViewNormalHeaders()
{
- const mode = Components.interfaces.nsMimeHeaderDisplayTypes.NormalHeaders;
+ const mode = Ci.nsMimeHeaderDisplayTypes.NormalHeaders;
Services.prefs.setIntPref("mail.show_headers", mode); // 1
AdjustHeaderView(mode);
ReloadMessage();
}
function MsgBodyAllowHTML()
{
Services.prefs.setBoolPref("mailnews.display.prefer_plaintext", false);
@@ -2611,53 +2610,53 @@ function PrintEnginePrintInternal(doPrin
"chrome,dialog=no,all,centerscreen",
messageList.length, messageList, statusFeedback,
doPrintPreview, msgType);
}
function PrintEnginePrint()
{
return PrintEnginePrintInternal(false,
- Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_MSG);
+ Ci.nsIMsgPrintEngine.MNAB_PRINT_MSG);
}
function PrintEnginePrintPreview()
{
return PrintEnginePrintInternal(true,
- Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_MSG);
+ Ci.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_MSG);
}
function IsMailFolderSelected()
{
var selectedFolders = GetSelectedMsgFolders();
var folder = selectedFolders.length ? selectedFolders[0] : null;
return folder && folder.server.type != "nntp";
}
function IsGetNewMessagesEnabled()
{
let allServers = accountManager.allServers;
for (let i = 0; i < allServers.length; ++i) {
- let server = allServers.queryElementAt(i, Components.interfaces.nsIMsgIncomingServer);
+ let server = allServers.queryElementAt(i, Ci.nsIMsgIncomingServer);
if (server.type == "none")
continue;
return true;
}
return false;
}
function IsGetNextNMessagesEnabled()
{
var selectedFolders = GetSelectedMsgFolders();
var folder = selectedFolders.length ? selectedFolders[0] : null;
var menuItem = document.getElementById("menu_getnextnmsg");
var appMenuItem = document.getElementById("appmenu_getNextNMsgs");
if (folder && !folder.isServer &&
- folder.server instanceof Components.interfaces.nsINntpIncomingServer) {
+ folder.server instanceof Ci.nsINntpIncomingServer) {
menuItem.label = PluralForm.get(folder.server.maxArticles,
document.getElementById("bundle_messenger")
.getString("getNextNewsMessages"))
.replace("#1", folder.server.maxArticles);
menuItem.removeAttribute("hidden");
if (appMenuItem) {
appMenuItem.label = menuItem.label;
appMenuItem.removeAttribute("hidden");
@@ -2794,32 +2793,32 @@ function GetFolderMessages()
* @param server which nsIMsgIncomingServer to check for new messages
* @param folder which nsIMsgFolder folder to check for new messages
*/
function GetNewMsgs(server, folder)
{
// Note that for Global Inbox folder.server != server when we want to get
// messages for a specific account.
- const nsIMsgFolder = Components.interfaces.nsIMsgFolder;
+ const nsIMsgFolder = Ci.nsIMsgFolder;
// Whenever we do get new messages, clear the old new messages.
folder.biffState = nsIMsgFolder.nsMsgBiffState_NoMail;
folder.clearNewMessages();
server.getNewMessages(folder, msgWindow, null);
}
function SendUnsentMessages()
{
- let msgSendlater = Components.classes["@mozilla.org/messengercompose/sendlater;1"]
- .getService(Components.interfaces.nsIMsgSendLater);
+ let msgSendlater = Cc["@mozilla.org/messengercompose/sendlater;1"]
+ .getService(Ci.nsIMsgSendLater);
let allIdentities = MailServices.accounts.allIdentities;
let identitiesCount = allIdentities.length;
for (let i = 0; i < identitiesCount; i++) {
- let currentIdentity = allIdentities.queryElementAt(i, Components.interfaces.nsIMsgIdentity);
+ let currentIdentity = allIdentities.queryElementAt(i, Ci.nsIMsgIdentity);
let msgFolder = msgSendlater.getUnsentMessagesFolder(currentIdentity);
if (msgFolder) {
let numMessages = msgFolder.getTotalMessages(false /* include subfolders */);
if (numMessages > 0) {
msgSendlater.sendUnsentMessages(currentIdentity);
// Right now, all identities point to the same unsent messages
// folder, so to avoid sending multiple copies of the
// unsent messages, we only call messenger.SendUnsentMessages() once.
@@ -2830,25 +2829,25 @@ function SendUnsentMessages()
}
}
function CoalesceGetMsgsForPop3ServersByDestFolder(currentServer,
pop3DownloadServersArray,
localFoldersToDownloadTo)
{
var outNumFolders = new Object();
- const kInboxFlag = Components.interfaces.nsMsgFolderFlags.Inbox;
+ const kInboxFlag = Ci.nsMsgFolderFlags.Inbox;
var inboxFolder = currentServer.rootMsgFolder.getFolderWithFlags(kInboxFlag);
// coalesce the servers that download into the same folder...
var index = localFoldersToDownloadTo.indexOf(inboxFolder);
if (index == -1)
{
if (inboxFolder)
{
- inboxFolder.biffState = Components.interfaces.nsIMsgFolder.nsMsgBiffState_NoMail;
+ inboxFolder.biffState = Ci.nsIMsgFolder.nsMsgBiffState_NoMail;
inboxFolder.clearNewMessages();
}
localFoldersToDownloadTo.push(inboxFolder);
index = pop3DownloadServersArray.length;
pop3DownloadServersArray.push([]);
}
pop3DownloadServersArray[index].push(currentServer);
}
@@ -2862,25 +2861,25 @@ function GetMessagesForAllAuthenticatedA
// Array of arrays of servers for a particular folder.
var pop3DownloadServersArray = [];
// parallel array of folders to download to...
var localFoldersToDownloadTo = [];
var pop3Server;
for (var i = 0; i < allServers.length; ++i)
{
- var currentServer = allServers.queryElementAt(i, Components.interfaces.nsIMsgIncomingServer);
+ var currentServer = allServers.queryElementAt(i, Ci.nsIMsgIncomingServer);
if (currentServer.protocolInfo.canGetMessages &&
!currentServer.passwordPromptRequired)
{
if (currentServer.type == "pop3")
{
CoalesceGetMsgsForPop3ServersByDestFolder(currentServer,
pop3DownloadServersArray, localFoldersToDownloadTo);
- pop3Server = currentServer.QueryInterface(Components.interfaces.nsIPop3IncomingServer);
+ pop3Server = currentServer.QueryInterface(Ci.nsIPop3IncomingServer);
}
else
// get new messages on the server for imap or rss
GetMessagesForInboxOnServer(currentServer);
}
}
for (var i = 0; i < pop3DownloadServersArray.length; ++i)
{
@@ -2977,28 +2976,28 @@ function HandleJunkStatusChanged(folder)
// In that scenario, we want to reload the message if the status has just
// changed to not junk.
var sanitizeJunkMail = Services.prefs.getBoolPref("mail.spam.display.sanitize");
// Only bother doing this if we are modifying the html for junk mail....
if (sanitizeJunkMail)
{
let junkScore = msgHdr.getStringProperty("junkscore");
- let isJunk = (junkScore == Components.interfaces.nsIJunkMailPlugin.IS_SPAM_SCORE);
+ let isJunk = (junkScore == Ci.nsIJunkMailPlugin.IS_SPAM_SCORE);
// If the current row isn't going to change, reload to show sanitized or
// unsanitized. Otherwise we wouldn't see the reloaded version anyway.
// 1) When marking as non-junk from the Junk folder, the msg would move
// back to the Inbox -> no reload needed
// When marking as non-junk from a folder other than the Junk folder,
// the message isn't moved back to Inbox -> reload needed
// (see nsMsgDBView::DetermineActionsForJunkChange)
// 2) When marking as junk, the msg will move or delete, if manualMark is set.
// 3) Marking as junk in the junk folder just changes the junk status.
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
if ((!isJunk && !folder.isSpecialFolder(nsMsgFolderFlags.Junk)) ||
(isJunk && !folder.server.spamSettings.manualMark) ||
(isJunk && folder.isSpecialFolder(nsMsgFolderFlags.Junk)))
ReloadMessage();
}
}
}
@@ -3028,17 +3027,17 @@ var gMessageNotificationBar =
goUpdateCommand("button_junk");
let brandName = this.brandBundle.getString("brandShortName");
let junkBarMsg = this.stringBundle.getFormattedString("junkBarMessage",
[brandName]);
let junkScore = aMsgHdr ? aMsgHdr.getStringProperty("junkscore") : "";
if ((junkScore == "") ||
- (junkScore == Components.interfaces.nsIJunkMailPlugin.IS_HAM_SCORE)) {
+ (junkScore == Ci.nsIJunkMailPlugin.IS_HAM_SCORE)) {
// not junk -> just close the notificaion then, if one was showing
let item = this.msgNotificationBar.getNotificationWithValue("junkContent");
if (item)
this.msgNotificationBar.removeNotification(item, true);
return;
}
let buttons = [{
@@ -3194,17 +3193,17 @@ var gMessageNotificationBar =
null, this.msgNotificationBar.PRIORITY_INFO_MEDIUM, buttons);
},
setDraftEditMessage: function() {
let msgHdr = gFolderDisplay.selectedMessage;
if (!msgHdr || !msgHdr.folder)
return;
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
if (msgHdr.folder.isSpecialFolder(nsMsgFolderFlags.Drafts, true))
{
let draftMsgNote = this.stringBundle.getString("draftMessageMsg");
let buttons = [{
label: this.stringBundle.getString("draftMessageButton"),
accessKey: this.stringBundle.getString("draftMessageButtonKey"),
popup: null,
@@ -3369,18 +3368,18 @@ function setMsgHdrPropertyAndReload(aPro
/**
* Mark a specified message as read.
* @param msgHdr header (nsIMsgDBHdr) of the message to mark as read
*/
function MarkMessageAsRead(msgHdr)
{
ClearPendingReadTimer();
- var headers = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var headers = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
headers.appendElement(msgHdr);
msgHdr.folder.markMessagesRead(headers, true);
}
function ClearPendingReadTimer()
{
if (gMarkViewedMessageAsReadTimer)
{
@@ -3439,17 +3438,17 @@ function OnMsgParsed(aUrl)
// Then check if the href url matches the document baseURL.
if (makeURI(linkNode.href).specIgnoringRef != makeURI(linkNode.baseURI).specIgnoringRef)
continue;
// Finally, if the document url is a message url, and the anchor href is
// http, it needs to be adjusted so docShell finds the node.
let messageURI = makeURI(linkNode.ownerDocument.URL);
- if (messageURI instanceof Components.interfaces.nsIMsgMailNewsUrl &&
+ if (messageURI instanceof Ci.nsIMsgMailNewsUrl &&
linkNode.href.startsWith("http"))
linkNode.href = messageURI.specIgnoringRef + linkNode.hash;
}
// Scale any overflowing images, exclude http content.
let imgs = doc && !doc.URL.startsWith("http") ? doc.images : [];
for (let img of imgs)
{
@@ -3547,27 +3546,27 @@ function HandleMDNResponse(aUrl)
{
var mimeMsgId = mimeHdr.extractHeader("Message-Id", false);
if (mimeMsgId)
msgHdr.messageId = mimeMsgId;
}
// After a msg is downloaded it's already marked READ at this point so we must check if
// the msg has a "Disposition-Notification-To" header and no MDN report has been sent yet.
- if (msgHdr.flags & Components.interfaces.nsMsgMessageFlags.MDNReportSent)
+ if (msgHdr.flags & Ci.nsMsgMessageFlags.MDNReportSent)
return;
var DNTHeader = mimeHdr.extractHeader("Disposition-Notification-To", false);
var oldDNTHeader = mimeHdr.extractHeader("Return-Receipt-To", false);
if (!DNTHeader && !oldDNTHeader)
return;
// Everything looks good so far, let's generate the MDN response.
- var mdnGenerator = Components.classes["@mozilla.org/messenger-mdn/generator;1"]
- .createInstance(Components.interfaces.nsIMsgMdnGenerator);
+ var mdnGenerator = Cc["@mozilla.org/messenger-mdn/generator;1"]
+ .createInstance(Ci.nsIMsgMdnGenerator);
const MDN_DISPOSE_TYPE_DISPLAYED = 0;
let askUser = mdnGenerator.process(MDN_DISPOSE_TYPE_DISPLAYED, msgWindow, msgFolder,
msgHdr.messageKey, mimeHdr, false);
if (askUser)
gMessageNotificationBar.setMDNMsg(mdnGenerator, msgHdr, mimeHdr);
}
function SendMDNResponse()
--- a/mail/base/content/messageWindow.js
+++ b/mail/base/content/messageWindow.js
@@ -437,17 +437,17 @@ function actuallyLoadMessage() {
// message header as an object?
if ("wrappedJSObject" in window.arguments[0]) {
let hdrObject = window.arguments[0].wrappedJSObject;
msgHdr = hdrObject.msgHdr;
if ("viewWrapperToClone" in hdrObject)
originViewWrapper = hdrObject.viewWrapperToClone;
}
// message header as a separate param?
- else if (window.arguments[0] instanceof Components.interfaces.nsIMsgDBHdr) {
+ else if (window.arguments[0] instanceof Ci.nsIMsgDBHdr) {
msgHdr = window.arguments[0];
originViewWrapper = window.arguments.length > 1 ?
window.arguments[1] : null;
}
// this is a message header, so show it
if (msgHdr) {
if (originViewWrapper) {
@@ -477,17 +477,17 @@ function actuallyLoadMessage() {
// and if it meets either of those same constraints (assuming it has a
// msgWindow), it will retrieve the header sink off the msgWindow, get
// the dummy header, and return that.
// so...
// - create a search view for the standalone dude
gFolderDisplay.view.openSearchView();
// - load the message
let messageURI = window.arguments[0];
- if (messageURI instanceof Components.interfaces.nsIURI)
+ if (messageURI instanceof Ci.nsIURI)
messageURI = messageURI.spec;
gMessageDisplay.displayExternalMessage(messageURI);
}
}
gFolderDisplay.makeActive();
// set focus to the message pane
@@ -798,17 +798,17 @@ function GetNumSelectedMessages()
{
return gFolderDisplay.selectedCount;
}
function ReloadMessage()
{
// If the current message was loaded from a file or attachment, so the dbView
// can't handle reloading it. Let's do it ourselves, instead.
- if (window.arguments[0] instanceof Components.interfaces.nsIURI)
+ if (window.arguments[0] instanceof Ci.nsIURI)
gMessageDisplay.displayExternalMessage(window.arguments[0].spec);
else
gFolderDisplay.view.dbView.reloadMessage();
}
// MessageWindowController object (handles commands when one of the trees does not have focus)
var MessageWindowController =
{
--- a/mail/base/content/msgHdrViewOverlay.js
+++ b/mail/base/content/msgHdrViewOverlay.js
@@ -112,19 +112,19 @@ var gExpandedHeaderView = {};
*/
var currentHeaderData = {};
/**
* CurrentAttachments is an array of AttachmentInfo objects.
*/
var currentAttachments = new Array();
-var nsIAbDirectory = Components.interfaces.nsIAbDirectory;
-var nsIAbListener = Components.interfaces.nsIAbListener;
-var nsIAbCard = Components.interfaces.nsIAbCard;
+var nsIAbDirectory = Ci.nsIAbDirectory;
+var nsIAbListener = Ci.nsIAbListener;
+var nsIAbCard = Ci.nsIAbCard;
/**
* Our constructor method which creates a header Entry based on an entry
* in one of the header lists. A header entry is different from a header list.
* A header list just describes how you want a particular header to be
* presented. The header entry actually has knowledge about the DOM
* and the actual DOM elements associated with the header.
*
@@ -222,17 +222,17 @@ function OnLoadMsgHeaderPane()
Services.prefs.addObserver("mail.showCondensedAddresses", MsgHdrViewObserver);
Services.prefs.addObserver("mailnews.headers.showReferences", MsgHdrViewObserver);
initializeHeaderViewTables();
// Add an address book listener so we can update the header view when things
// change.
MailServices.ab.addAddressBookListener(AddressBookListener,
- Components.interfaces.nsIAbListener.all);
+ Ci.nsIAbListener.all);
// If an invalid index is selected; reset to 0. One way this can happen
// is if a value of 1 was persisted to localStore.rdf by Tb2 (when there were
// two panels), and then the user upgraded to Tb3, which only has one.
// Presumably this can also catch cases of extension uninstalls as well.
let deckElement = document.getElementById("msgHeaderViewDeck")
// If the selectedIndex was 0, then we were using the compact header, (if we
@@ -371,17 +371,17 @@ var AddressBookListener =
OnAddressBookDataChanged(aItem instanceof nsIAbCard ?
nsIAbListener.directoryItemRemoved :
nsIAbListener.directoryRemoved,
aParentDir, aItem);
},
onItemPropertyChanged: function(aItem, aProperty, aOldValue, aNewValue) {
// We only need updates for card changes, address book and mailing list
// ones don't affect us here.
- if (aItem instanceof Components.interfaces.nsIAbCard)
+ if (aItem instanceof Ci.nsIAbCard)
OnAddressBookDataChanged(nsIAbListener.itemChanged, null, aItem);
}
};
function OnAddressBookDataChanged(aAction, aParentDir, aItem) {
gEmailAddressHeaderNames.forEach(function (headerName) {
let headerEntry = null;
@@ -396,17 +396,17 @@ function OnAddressBookDataChanged(aActio
}
/**
* The messageHeaderSink is the class that gets notified of a message's headers
* as we display the message through our mime converter.
*/
var messageHeaderSink = {
QueryInterface: XPCOMUtils.generateQI(
- [Components.interfaces.nsIMsgHeaderSink]),
+ [Ci.nsIMsgHeaderSink]),
onStartHeaders: function()
{
this.mSaveHdr = null;
// Every time we start to redisplay a message, check the view all headers
// pref...
var showAllHeadersPref = Services.prefs.getIntPref("mail.show_headers");
if (showAllHeadersPref == 2) {
gViewAllHeaders = true;
@@ -593,27 +593,27 @@ var messageHeaderSink = {
var displayHtmlAs = Services.prefs.getIntPref("mailnews.display.html_as");
if (inlineAttachments && !displayHtmlAs)
return;
}
var size = null;
if (isExternalAttachment && url.startsWith("file:")) {
let fileHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
try {
let file = fileHandler.getFileFromURLSpec(url);
// Can't get size for detached attachments which are no longer
// available on the specified location.
if (file.exists())
size = file.fileSize;
}
catch(e) {
- Components.utils.reportError("Couldn't open external attachment; " +
- "url=" + url + "; " + e);
+ Cu.reportError("Couldn't open external attachment; " +
+ "url=" + url + "; " + e);
}
}
currentAttachments.push(new AttachmentInfo(contentType, url, displayName,
uri, isExternalAttachment,
size));
this.skipAttachment = false;
@@ -696,17 +696,17 @@ var messageHeaderSink = {
let expanded = Services.prefs.getBoolPref(
"mailnews.attachments.display.start_expanded");
if (expanded)
toggleAttachmentList(true);
// if we don't have any attachments, turn off the attachments flag
if (!this.mSaveHdr) {
- var messageUrl = url.QueryInterface(Components.interfaces.nsIMsgMessageUrl);
+ var messageUrl = url.QueryInterface(Ci.nsIMsgMessageUrl);
this.mSaveHdr = messenger.msgHdrFromURI(messageUrl.uri);
}
if (!currentAttachments.length && this.mSaveHdr)
this.mSaveHdr.markHasAttachments(false);
let browser = getBrowser();
if (currentAttachments.length &&
Services.prefs.getBoolPref("mail.inline_attachments") &&
@@ -767,18 +767,18 @@ var messageHeaderSink = {
// we create it; the onStartHeaders might come after creation!)
this.mSaveHdr = this.mDummyMsgHeader;
return this.mDummyMsgHeader;
},
mProperties: null,
get properties()
{
if (!this.mProperties)
- this.mProperties = Components.classes["@mozilla.org/hash-property-bag;1"].
- createInstance(Components.interfaces.nsIWritablePropertyBag2);
+ this.mProperties = Cc["@mozilla.org/hash-property-bag;1"].
+ createInstance(Ci.nsIWritablePropertyBag2);
return this.mProperties;
},
resetProperties: function() {
this.mProperties = null;
}
};
@@ -1580,18 +1580,18 @@ function AddContact(emailAddressNode)
// the UI so that accidentally double-clicking on the star doesn't lead
// to something strange (i.e star would be moved out from underneath,
// leaving something else there).
emailAddressNode.setAttribute("updatingUI", true);
const kPersonalAddressbookURI = "moz-abmdbdirectory://abook.mab";
let addressBook = MailServices.ab.getDirectory(kPersonalAddressbookURI);
- let card = Components.classes["@mozilla.org/addressbook/cardproperty;1"]
- .createInstance(Components.interfaces.nsIAbCard);
+ let card = Cc["@mozilla.org/addressbook/cardproperty;1"]
+ .createInstance(Ci.nsIAbCard);
card.displayName = emailAddressNode.getAttribute("displayName");
card.primaryEmail = emailAddressNode.getAttribute("emailAddress");
// Just save the new node straight away.
addressBook.addCard(card);
emailAddressNode.removeAttribute("updatingUI");
}
@@ -1607,36 +1607,36 @@ function EditContact(emailAddressNode)
* Takes the email address title button, extracts the email address we stored
* in there and opens a compose window with that address.
*
* @param addressNode a node which has a "fullAddress" or "newsgroup" attribute
* @param aEvent the event object when user triggers the menuitem
*/
function SendMailToNode(addressNode, aEvent)
{
- let fields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
- .createInstance(Components.interfaces.nsIMsgCompFields);
- let params = Components.classes["@mozilla.org/messengercompose/composeparams;1"]
- .createInstance(Components.interfaces.nsIMsgComposeParams);
+ let fields = Cc["@mozilla.org/messengercompose/composefields;1"]
+ .createInstance(Ci.nsIMsgCompFields);
+ let params = Cc["@mozilla.org/messengercompose/composeparams;1"]
+ .createInstance(Ci.nsIMsgComposeParams);
fields.newsgroups = addressNode.getAttribute("newsgroup");
if (addressNode.hasAttribute("fullAddress")) {
let addresses = MailServices.headerParser.makeFromDisplayAddress(
addressNode.getAttribute("fullAddress"), {});
if (addresses.length > 0)
fields.to = MailServices.headerParser.makeMimeHeader(addresses, 1);
}
- params.type = Components.interfaces.nsIMsgCompType.New;
+ params.type = Ci.nsIMsgCompType.New;
// If aEvent is passed, check if Shift key was pressed for composition in
// non-default format (HTML vs. plaintext).
params.format = (aEvent && aEvent.shiftKey) ?
- Components.interfaces.nsIMsgCompFormat.OppositeOfDefault :
- Components.interfaces.nsIMsgCompFormat.Default;
+ Ci.nsIMsgCompFormat.OppositeOfDefault :
+ Ci.nsIMsgCompFormat.Default;
if (gFolderDisplay.displayedFolder) {
params.identity = accountManager.getFirstIdentityForServer(
gFolderDisplay.displayedFolder.server);
}
params.composeFields = fields;
MailServices.compose.OpenComposeWindowWithParams(null, params);
}
@@ -1647,18 +1647,18 @@ function SendMailToNode(addressNode, aEv
*
* @param addressNode a node which has an "emailAddress" or "newsgroup"
* attribute
* @param aIncludeName when true, also copy the name onto the clipboard,
* otherwise only the email address
*/
function CopyEmailNewsAddress(addressNode, aIncludeName = false)
{
- let clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper);
let address = addressNode.getAttribute(aIncludeName ? "fullAddress"
: "emailAddress") ||
addressNode.getAttribute("newsgroup");
clipboard.copyString(address);
}
/**
* Causes the filter dialog to pop up, prefilled for the specified e-mail
@@ -1684,17 +1684,17 @@ function CreateFilter(aHeaderNode, aMess
*
* @return nsISubscribableServer for the newsgroup, or null
*/
function GetNewsgroupServer()
{
if (gFolderDisplay.selectedMessageIsNews) {
let server = gFolderDisplay.selectedMessage.folder.server;
if (server)
- return server.QueryInterface(Components.interfaces.nsISubscribableServer);
+ return server.QueryInterface(Ci.nsISubscribableServer);
}
return null;
}
/**
* Initialize the newsgroup popup, showing/hiding menu items as appropriate.
*
* @param newsgroupNode a node which has a "newsgroup" attribute
@@ -1705,17 +1705,17 @@ function setupNewsgroupPopup(newsgroupNo
let newsgroup = newsgroupNode.getAttribute("newsgroup");
newsgroupNode.setAttribute("selected", "true");
newsgroupPlaceHolder.setAttribute("label", newsgroup);
let server = GetNewsgroupServer();
if (server) {
// XXX Why is this necessary when nsISubscribableServer contains
// |isSubscribed|?
- server = server.QueryInterface(Components.interfaces.nsINntpIncomingServer);
+ server = server.QueryInterface(Ci.nsINntpIncomingServer);
if (!server.containsNewsgroup(newsgroup)) {
document.getElementById("subscribeToNewsgroupItem")
.removeAttribute("hidden");
document.getElementById("subscribeToNewsgroupSeparator")
.removeAttribute("hidden");
return;
}
}
@@ -1743,18 +1743,18 @@ function SubscribeToNewsgroup(newsgroupN
/**
* Takes the newsgroup address title button, extracts the newsgroup name we
* stored in there and copies it to the clipboard.
*
* @param newsgroupNode a node which has a "newsgroup" attribute
*/
function CopyNewsgroupName(newsgroupNode)
{
- let clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper);
clipboard.copyString(newsgroupNode.getAttribute("newsgroup"));
}
/**
* Takes the newsgroup address title button, extracts the newsgroup name we
* stored in there and copies it URL to it.
*
* @param newsgroupNode a node which has a "newsgroup" attribute
@@ -1763,35 +1763,35 @@ function CopyNewsgroupURL(newsgroupNode)
{
let server = GetNewsgroupServer();
if (!server)
return;
let ng = newsgroupNode.getAttribute("newsgroup");
let url;
- if (server.socketType != Components.interfaces.nsMsgSocketType.SSL) {
+ if (server.socketType != Ci.nsMsgSocketType.SSL) {
url = "news://" + server.hostName;
- if (server.port != Components.interfaces.nsINntpUrl.DEFAULT_NNTP_PORT)
+ if (server.port != Ci.nsINntpUrl.DEFAULT_NNTP_PORT)
url += ":" + server.port;
url += "/" + ng;
} else {
url = "snews://" + server.hostName;
- if (server.port != Components.interfaces.nsINntpUrl.DEFAULT_NNTPS_PORT)
+ if (server.port != Ci.nsINntpUrl.DEFAULT_NNTPS_PORT)
url += ":" + server.port;
url += "/" + ng;
}
try {
let uri = Services.io.newURI(url);
- let clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper);
clipboard.copyString(decodeURI(uri.spec));
} catch(e) {
- Components.utils.reportError("Invalid URL: "+ url);
+ Cu.reportError("Invalid URL: "+ url);
}
}
/**
* Create a new attachment object which goes into the data attachment array.
* This method checks whether the passed attachment is empty or not.
*
* @param contentType The attachment's mimetype
@@ -1908,37 +1908,37 @@ AttachmentInfo.prototype = {
get isEmpty()
{
// Create an input stream on the attachment url.
let url = Services.io.newURI(this.url);
let channel = Services.io.newChannelFromURI2(url,
null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
let stream = channel.open();
- let inputStream = Components.classes["@mozilla.org/binaryinputstream;1"]
- .createInstance(Components.interfaces.nsIBinaryInputStream);
+ let inputStream = Cc["@mozilla.org/binaryinputstream;1"]
+ .createInstance(Ci.nsIBinaryInputStream);
inputStream.setInputStream(stream);
let bytesAvailable = 0;
if (inputStream.isNonBlocking()) {
// If the stream does not block, test on two conditions:
// - attachment is empty -> 0 bytes will be returned on readBytes()
// - attachment is not empty -> NS_BASE_STREAM_WOULD_BLOCK exception is
// thrown
let chunk = null;
try {
chunk = inputStream.readBytes(1);
} catch (ex) {
- if (ex.result == Components.results.NS_BASE_STREAM_WOULD_BLOCK) {
+ if (ex.result == Cr.NS_BASE_STREAM_WOULD_BLOCK) {
bytesAvailable = 1;
} else {
throw ex;
}
}
if (chunk)
bytesAvailable = chunk.length;
} else {
@@ -2604,17 +2604,17 @@ function HandleAllAttachments(action)
* @param action one of "open", "save", "saveAs", "detach", or "delete"
*/
function TryHandleAllAttachments(action)
{
try {
HandleAllAttachments(action)
}
catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
/**
* Handle the currently-selected attachments in this message (save them, open
* them, etc).
*
* @param action one of "open", "save", "saveAs", "detach", or "delete"
@@ -2712,18 +2712,18 @@ function HandleMultipleAttachments(attac
actionFunction(attachments[i]);
else
setTimeout(actionFunction, 100, attachments[i]);
}
return;
case "copyUrl":
// Copy external http url(s) to clipboard. The menuitem is hidden unless
// all selected attachment urls are http.
- let clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper);
clipboard.copyString(attachmentUrlArray.join("\n"));
return;
default:
throw new Error("unknown HandleMultipleAttachments action: " + action);
}
}
function ClearAttachmentList()
@@ -2776,18 +2776,18 @@ var attachmentNameDNDObserver = {
* the website address we stored in there and copies it to the clipboard
*/
function CopyWebsiteAddress(websiteAddressNode)
{
if (websiteAddressNode) {
var websiteAddress = websiteAddressNode.textContent;
var contractid = "@mozilla.org/widget/clipboardhelper;1";
- var iid = Components.interfaces.nsIClipboardHelper;
- var clipboard = Components.classes[contractid].getService(iid);
+ var iid = Ci.nsIClipboardHelper;
+ var clipboard = Cc[contractid].getService(iid);
clipboard.copyString(websiteAddress);
}
}
function nsDummyMsgHeader()
{
}
@@ -2880,18 +2880,18 @@ ConversationOpener.prototype = {
},
onItemsModified: function(aItems) {
},
onItemsRemoved: function(aItems) {
},
onQueryCompleted: function(aCollection) {
try {
if (!aCollection.items.length) {
- Components.utils.reportError("Couldn't find a collection for msg: " +
- this._msgHdr);
+ Cu.reportError("Couldn't find a collection for msg: " +
+ this._msgHdr);
} else {
let aMessage = aCollection.items[0];
let tabmail = document.getElementById("tabmail");
tabmail.openTab("glodaList", {
conversation: aMessage.conversation,
message: aMessage,
title: aMessage.conversation.subject,
background: false
--- a/mail/base/content/msgMail3PaneWindow.js
+++ b/mail/base/content/msgMail3PaneWindow.js
@@ -77,27 +77,27 @@ var folderListener = {
OnItemBoolPropertyChanged: function(item, property, oldValue, newValue) { },
OnItemUnicharPropertyChanged: function(item, property, oldValue, newValue) { },
OnItemPropertyFlagChanged: function(item, property, oldFlag, newFlag) { },
OnItemEvent: function(folder, event) {
if (event == "ImapHdrDownloaded") {
if (folder) {
- var imapFolder = folder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ var imapFolder = folder.QueryInterface(Ci.nsIMsgImapMailFolder);
if (imapFolder) {
var hdrParser = imapFolder.hdrParser;
if (hdrParser) {
var msgHdr = hdrParser.GetNewMsgHdr();
if (msgHdr)
{
var hdrs = hdrParser.headers;
if (hdrs && hdrs.indexOf("X-attachment-size:") > 0) {
- msgHdr.OrFlags(Components.interfaces.nsMsgMessageFlags
- .Attachment);
+ msgHdr.OrFlags(Ci.nsMsgMessageFlags
+ .Attachment);
}
if (hdrs && hdrs.indexOf("X-image-size:") > 0) {
msgHdr.setStringProperty("imageSize", "1");
}
}
}
}
}
@@ -450,17 +450,17 @@ function LoadPostAccountWizard()
MigrateOpenMessageBehavior();
ChromeUtils.import("resource:///modules/mailMigrator.js");
MailMigrator.migratePostAccountWizard();
accountManager.setSpecialFolders();
try {
accountManager.loadVirtualFolders();
- } catch (e) {Components.utils.reportError(e);}
+ } catch (e) {Cu.reportError(e);}
accountManager.addIncomingServerListener(gThreePaneIncomingServerListener);
gPhishingDetector.init();
AddToSession();
//need to add to session before trying to load start folder otherwise listeners aren't
//set up correctly.
@@ -470,18 +470,18 @@ function LoadPostAccountWizard()
{
let arg0 = window.arguments[0];
// If the argument is a string, it is either a folder URI or a feed URI
if (typeof arg0 == "string")
{
// filter our any feed urls that came in as arguments to the new window...
if (arg0.toLowerCase().startsWith("feed:"))
{
- let feedHandler = Components.classes["@mozilla.org/newsblog-feed-downloader;1"]
- .getService(Components.interfaces.nsINewsBlogFeedDownloader);
+ let feedHandler = Cc["@mozilla.org/newsblog-feed-downloader;1"]
+ .getService(Ci.nsINewsBlogFeedDownloader);
if (feedHandler)
feedHandler.subscribeToFeed(arg0, null, msgWindow);
}
else
{
startFolderURI = arg0;
}
}
@@ -492,22 +492,22 @@ function LoadPostAccountWizard()
arg0 = arg0.wrappedJSObject;
startMsgHdr = ("msgHdr" in arg0) ? arg0.msgHdr : null;
}
}
function completeStartup() {
// Check whether we need to show the default client dialog
// First, check the shell service
- var nsIShellService = Components.interfaces.nsIShellService;
+ var nsIShellService = Ci.nsIShellService;
if (nsIShellService) {
var shellService;
var defaultAccount;
try {
- shellService = Components.classes["@mozilla.org/mail/shell-service;1"].getService(nsIShellService);
+ shellService = Cc["@mozilla.org/mail/shell-service;1"].getService(nsIShellService);
defaultAccount = accountManager.defaultAccount;
} catch (ex) {}
// Next, try loading the search integration module
// We'll get a null SearchIntegration if we don't have one
ChromeUtils.import("resource:///modules/SearchIntegration.js");
// Show the default client dialog only if
@@ -804,17 +804,17 @@ function loadStartFolder(initialUri)
// Get the user pref to see if the login at startup is enabled for default account
isLoginAtStartUpEnabled = defaultServer.loginAtStartUp;
// Get Inbox only if login at startup is enabled.
if (isLoginAtStartUpEnabled)
{
//now find Inbox
var outNumFolders = new Object();
- const kInboxFlag = Components.interfaces.nsMsgFolderFlags.Inbox;
+ const kInboxFlag = Ci.nsMsgFolderFlags.Inbox;
var inboxFolder = rootMsgFolder.getFolderWithFlags(kInboxFlag);
if (!inboxFolder) return;
startFolder = inboxFolder;
}
}
// it is possible we were given an initial uri and we need to subscribe or try to add
@@ -845,17 +845,17 @@ function loadStartFolder(initialUri)
if (initialUri && !startFolder.parent)
{
// hack to force display of thread pane.
ShowingThreadPane();
messenger.loadURL(window, initialUri);
return;
}
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
MsgGetMessagesForAllServers(defaultServer);
if (MailOfflineMgr.isOnline()) {
// Check if we shut down offline, and restarted online, in which case
// we may have offline events to playback. Since this is not a pref
// the user should set, it's not in mailnews.js, so we need a try catch.
@@ -876,17 +876,17 @@ function loadStartFolder(initialUri)
if (MailOfflineMgr.shouldSendUnsentMessages())
SendUnsentMessages();
}, 0);
}
}
function AddToSession()
{
- var nsIFolderListener = Components.interfaces.nsIFolderListener;
+ var nsIFolderListener = Ci.nsIFolderListener;
var notifyFlags = nsIFolderListener.intPropertyChanged | nsIFolderListener.event;
MailServices.mailSession.AddFolderListener(folderListener, notifyFlags);
}
function InitPanes()
{
gFolderTreeView.load(document.getElementById("folderTree"),
"folderTree.json");
@@ -1234,22 +1234,22 @@ function MigrateFolderViews()
var folderViewsVersion = Services.prefs.getIntPref("mail.folder.views.version");
if (!folderViewsVersion)
{
var servers = accountManager.allServers;
var server;
var inbox;
for (var index = 0; index < servers.length; index++)
{
- server = servers.queryElementAt(index, Components.interfaces.nsIMsgIncomingServer);
+ server = servers.queryElementAt(index, Ci.nsIMsgIncomingServer);
if (server)
{
inbox = GetInboxFolder(server);
if (inbox)
- inbox.setFlag(Components.interfaces.nsMsgFolderFlags.Favorite);
+ inbox.setFlag(Ci.nsMsgFolderFlags.Favorite);
}
}
Services.prefs.setIntPref("mail.folder.views.version", 1);
}
}
// Do a one-time migration of the old mailnews.reuse_message_window pref to the
// newer mail.openMessageBehavior. This does the migration only if the old pref
@@ -1297,17 +1297,17 @@ function ThreadPaneOnDragStart(aEvent) {
// see NS_MAX_FILEDESCRIPTOR in m-c/widget/windows/nsDataObj.cpp .
const maxUncutNameLength = 124;
let maxCutNameLength = maxUncutNameLength - longSubjectTruncator.length;
let messages = new Map();
for (let [index, msgUri] of messageUris.entries()) {
let msgService = messenger.messageServiceFromURI(msgUri);
let msgHdr = msgService.messageURIToMsgHdr(msgUri);
let subject = msgHdr.mime2DecodedSubject || "";
- if (msgHdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe)
+ if (msgHdr.flags & Ci.nsMsgMessageFlags.HasRe)
subject = "Re: " + subject;
let uniqueFileName;
// If there is no subject, use a default name.
// If subject needs to be truncated, add a truncation character to indicate it.
if (!subject) {
uniqueFileName = noSubjectString;
} else {
@@ -1348,43 +1348,43 @@ function ThreadPaneOnDragStart(aEvent) {
aEvent.dataTransfer.effectAllowed = "copyMove";
aEvent.dataTransfer.addElement(aEvent.originalTarget);
}
function messageFlavorDataProvider() {
}
messageFlavorDataProvider.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIFlavorDataProvider,
- Components.interfaces.nsISupports]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIFlavorDataProvider,
+ Ci.nsISupports]),
getFlavorData : function(aTransferable, aFlavor, aData, aDataLen) {
if (aFlavor !== "application/x-moz-file-promise") {
return;
}
let fileUriPrimitive = {};
let dataSize = {};
aTransferable.getTransferData("application/x-moz-file-promise-url",
fileUriPrimitive, dataSize);
- let fileUriStr = fileUriPrimitive.value.QueryInterface(Components.interfaces.nsISupportsString);
+ let fileUriStr = fileUriPrimitive.value.QueryInterface(Ci.nsISupportsString);
let fileUri = Services.io.newURI(fileUriStr.data);
- let fileUrl = fileUri.QueryInterface(Components.interfaces.nsIURL);
+ let fileUrl = fileUri.QueryInterface(Ci.nsIURL);
let fileName = fileUrl.fileName;
let destDirPrimitive = {};
aTransferable.getTransferData("application/x-moz-file-promise-dir",
destDirPrimitive, dataSize);
- let destDirectory = destDirPrimitive.value.QueryInterface(Components.interfaces.nsIFile);
+ let destDirectory = destDirPrimitive.value.QueryInterface(Ci.nsIFile);
let file = destDirectory.clone();
file.append(fileName);
let messageUriPrimitive = {};
aTransferable.getTransferData("text/x-moz-message", messageUriPrimitive, dataSize);
- let messageUri = messageUriPrimitive.value.QueryInterface(Components.interfaces.nsISupportsString);
+ let messageUri = messageUriPrimitive.value.QueryInterface(Ci.nsISupportsString);
messenger.saveAs(messageUri.data, true, null, decodeURIComponent(file.path), true);
}
}
/**
* Returns a new filename that is guaranteed to not be in the Set
* of existing names.
@@ -1409,40 +1409,40 @@ function suggestUniqueFileName(aIdentifi
suggestion = base + suffix + aType;
suffix++;
}
return suggestion;
}
function ThreadPaneOnDragOver(aEvent) {
- let ds = Components.classes["@mozilla.org/widget/dragservice;1"]
- .getService(Components.interfaces.nsIDragService)
- .getCurrentSession();
+ let ds = Cc["@mozilla.org/widget/dragservice;1"]
+ .getService(Ci.nsIDragService)
+ .getCurrentSession();
ds.canDrop = false;
if (!gFolderDisplay.displayedFolder.canFileMessages)
return;
let dt = aEvent.dataTransfer;
if (Array.from(dt.mozTypesAt(0)).includes("application/x-moz-file")) {
let extFile = dt.mozGetDataAt("application/x-moz-file", 0)
- .QueryInterface(Components.interfaces.nsIFile);
+ .QueryInterface(Ci.nsIFile);
if (extFile.isFile()) {
let len = extFile.leafName.length;
if (len > 4 && extFile.leafName.toLowerCase().endsWith(".eml"))
ds.canDrop = true;
}
}
}
function ThreadPaneOnDrop(aEvent) {
let dt = aEvent.dataTransfer;
for (let i = 0; i < dt.mozItemCount; i++) {
let extFile = dt.mozGetDataAt("application/x-moz-file", i)
- .QueryInterface(Components.interfaces.nsIFile);
+ .QueryInterface(Ci.nsIFile);
if (extFile.isFile()) {
let len = extFile.leafName.length;
if (len > 4 && extFile.leafName.toLowerCase().endsWith(".eml"))
MailServices.copy.CopyFileMessage(extFile, gFolderDisplay.displayedFolder,
null, false, 1, "", null, msgWindow);
}
}
}
--- a/mail/base/content/msgViewNavigation.js
+++ b/mail/base/content/msgViewNavigation.js
@@ -11,17 +11,17 @@ ChromeUtils.import("resource://gre/modul
function GetSubFoldersInFolderPaneOrder(folder)
{
var subFolders = folder.subFolders;
var msgFolders = Array();
// get all the subfolders
while (subFolders.hasMoreElements()) {
msgFolders[msgFolders.length] =
- subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
+ subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
}
function compareFolderSortKey(folder1, folder2) {
return folder1.compareSortKeys(folder2);
}
// sort the subfolders
msgFolders.sort(compareFolderSortKey);
@@ -38,17 +38,17 @@ function FindNextChildFolder(aParent, aA
var subFolders = GetSubFoldersInFolderPaneOrder(aParent);
var i = 0;
var folder = null;
// Skip folders until after the specified child
while (folder != aAfter)
folder = subFolders[i++];
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
let ignoreFlags = nsMsgFolderFlags.Trash | nsMsgFolderFlags.SentMail |
nsMsgFolderFlags.Drafts | nsMsgFolderFlags.Queue |
nsMsgFolderFlags.Templates | nsMsgFolderFlags.Junk;
while (i < subFolders.length) {
folder = subFolders[i++];
// If there is unread mail in the trash, sent, drafts, unsent messages
// templates or junk special folder,
// we ignore it when doing cross folder "next" navigation.
--- a/mail/base/content/multimessageview.js
+++ b/mail/base/content/multimessageview.js
@@ -5,18 +5,18 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource:///modules/gloda/gloda.js");
ChromeUtils.import("resource:///modules/gloda/connotent.js");
ChromeUtils.import("resource:///modules/gloda/mimemsg.js");
ChromeUtils.import("resource:///modules/displayNameUtils.js");
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource:///modules/templateUtils.js");
-var gMessenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+var gMessenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
// Set up our string formatter for localizing strings.
XPCOMUtils.defineLazyGetter(this, "formatString", function() {
let formatter = new PluralStringFormatter(
"chrome://messenger/locale/multimessageview.properties"
);
return function(...args) {
return formatter.get(...args);
@@ -188,17 +188,17 @@ MultiMessageSummary.prototype = {
* showSubject: true if the subject of the message
* should be shown; defaults to false
* snippetLength: the length in bytes of the message
* snippet; defaults to undefined (let Gloda decide)
* @return A DOM node for the summary item.
*/
makeSummaryItem: function(aMsgOrThread, aOptions) {
let message, thread, numUnread, isStarred, tags;
- if (aMsgOrThread instanceof Components.interfaces.nsIMsgDBHdr) {
+ if (aMsgOrThread instanceof Ci.nsIMsgDBHdr) {
thread = null;
message = aMsgOrThread;
numUnread = message.isRead ? 0 : 1;
isStarred = message.isFlagged;
tags = this._getTagsForMsg(message);
}
@@ -294,17 +294,17 @@ MultiMessageSummary.prototype = {
let [text, meta] = mimeMsgToContentSnippetAndMeta(
aMimeMsg, aMsgHdr.folder, kSnippetLength
);
snippetNode.textContent = text;
if (meta.author)
authorNode.textContent = meta.author;
}, false, {saneBodySize: true});
} catch (e) {
- if (e.result == Components.results.NS_ERROR_FAILURE) {
+ if (e.result == Cr.NS_ERROR_FAILURE) {
// Offline messages generate exceptions, which is unfortunate. When
// that's fixed, this code should adapt. XXX
snippetNode.textContent = "...";
} else {
throw e;
}
}
--- a/mail/base/content/nsContextMenu.js
+++ b/mail/base/content/nsContextMenu.js
@@ -470,40 +470,40 @@ nsContextMenu.prototype = {
// Set up early the right flags for editable / not editable.
let editFlags = SpellCheckHelper.isEditable(this.target, window);
this.onTextInput = (editFlags & SpellCheckHelper.TEXTINPUT) !== 0;
this.onEditableArea = (editFlags & SpellCheckHelper.EDITABLE) !== 0;
// First, do checks for nodes that never have children.
if (this.target.nodeType == Node.ELEMENT_NODE) {
- if (this.target instanceof Components.interfaces.nsIImageLoadingContent &&
+ if (this.target instanceof Ci.nsIImageLoadingContent &&
this.target.currentURI) {
this.onImage = true;
this.onMetaDataItem = true;
- var request = this.target.getRequest(Components.interfaces.nsIImageLoadingContent.CURRENT_REQUEST);
+ var request = this.target.getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST);
if (request && (request.imageStatus & request.STATUS_SIZE_AVAILABLE))
this.onLoadedImage = true;
this.imageURL = this.target.currentURI.spec;
} else if (this.target instanceof HTMLInputElement) {
this.onTextInput = this.isTargetATextBox(this.target);
} else if (editFlags & (SpellCheckHelper.INPUT | SpellCheckHelper.TEXTAREA)) {
if (!this.target.readOnly) {
this.onEditableArea = true;
- gSpellChecker.init(this.target.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor);
+ gSpellChecker.init(this.target.QueryInterface(Ci.nsIDOMNSEditableElement).editor);
gSpellChecker.initFromEvent(document.popupRangeParent, document.popupRangeOffset);
}
} else if (editFlags & (SpellCheckHelper.CONTENTEDITABLE)) {
let targetWin = this.target.ownerDocument.defaultView;
- let editingSession = targetWin.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIEditingSession);
+ let editingSession = targetWin.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIEditingSession);
gSpellChecker.init(editingSession.getEditorForWindow(targetWin));
gSpellChecker.initFromEvent(document.popupRangeParent, document.popupRangeOffset);
} else if (this.target instanceof HTMLCanvasElement) {
this.onCanvas = true;
} else if (this.target instanceof HTMLVideoElement) {
this.onVideo = true;
this.onPlayableMedia = true;
this.mediaURL = this.target.currentSrc || this.target.src;
@@ -635,17 +635,17 @@ nsContextMenu.prototype = {
* Determine whether the clicked-on link can be saved, and whether it
* may be saved according to the ScriptSecurityManager.
* @return true if the protocol can be persisted and if the target has
* permission to link to the URL, false if not
*/
isLinkSaveable : function CM_isLinkSaveable() {
try {
const nsIScriptSecurityManager =
- Components.interfaces.nsIScriptSecurityManager;
+ Ci.nsIScriptSecurityManager;
Services.scriptSecurityManager.checkLoadURIWithPrincipal(this.target.nodePrincipal,
this.linkURI, nsIScriptSecurityManager.STANDARD);
} catch (e) {
// Don't save things we can't link to.
return false;
}
// We don't do the Right Thing for news/snews yet, so turn them off
@@ -690,26 +690,26 @@ nsContextMenu.prototype = {
addresses = url.substring(kMailToLength, qmark);
} else {
addresses = url.substr(kMailToLength);
}
// Let's try to unescape it using a character set.
try {
var characterSet = this.target.ownerDocument.characterSet;
- const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
- .getService(Components.interfaces.nsITextToSubURI);
+ const textToSubURI = Cc["@mozilla.org/intl/texttosuburi;1"]
+ .getService(Ci.nsITextToSubURI);
addresses = textToSubURI.unEscapeURIForUI(characterSet, addresses);
}
catch(ex) {
// Do nothing.
}
- var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper);
clipboard.copyString(addresses);
},
///////////////
// Utilities //
///////////////
/**
@@ -954,34 +954,34 @@ nsContextMenu.prototype = {
openInBrowser: function CM_openInBrowser() {
let uri = Services.io.newURI(this.target.ownerDocument.defaultView.
top.location.href);
PlacesUtils.asyncHistory.updatePlaces({
uri: uri,
visits: [{
visitDate: Date.now() * 1000,
- transitionType: Components.interfaces.nsINavHistoryService.TRANSITION_LINK
+ transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
}]
});
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
- .loadURI(uri);
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(uri);
},
openLinkInBrowser: function CM_openLinkInBrowser() {
PlacesUtils.asyncHistory.updatePlaces({
uri: this.linkURI,
visits: [{
visitDate: Date.now() * 1000,
- transitionType: Components.interfaces.nsINavHistoryService.TRANSITION_LINK
+ transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
}]
});
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
.loadURI(this.linkURI);
},
mediaCommand : function CM_mediaCommand(command) {
var media = this.target;
switch (command) {
case "play":
--- a/mail/base/content/nsDragAndDrop.js
+++ b/mail/base/content/nsDragAndDrop.js
@@ -41,18 +41,18 @@ var nsTransferable = {
{
var currData = aTransferDataSet.dataList[i];
var currFlavour = currData.flavour.contentType;
trans.addDataFlavor(currFlavour);
var supports = null; // nsISupports data
var length = 0;
if (currData.flavour.dataIIDKey == "nsISupportsString")
{
- supports = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ supports = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
supports.data = currData.supports;
length = supports.data.length;
}
else
{
// non-string data.
supports = currData.supports;
@@ -88,17 +88,17 @@ var nsTransferable = {
var array = aRetrievalFunc(aFlavourSet);
var dataArray = [];
// Iterate over the number of items returned from aRetrievalFunc. For
// clipboard operations, this is 1, for drag and drop (where multiple
// items may have been dragged) this could be >1.
for (let i = 0; i < array.length; i++)
{
- let trans = array.queryElementAt(i, Components.interfaces.nsITransferable);
+ let trans = array.queryElementAt(i, Ci.nsITransferable);
if (!trans)
continue;
var data = { };
var length = { };
var currData = null;
if (aAnyFlag)
@@ -126,18 +126,18 @@ var nsTransferable = {
/**
* nsITransferable createTransferable (void) ;
*
* Creates and returns a transferable object.
**/
createTransferable: function ()
{
const kXferableContractID = "@mozilla.org/widget/transferable;1";
- const kXferableIID = Components.interfaces.nsITransferable;
- var trans = Components.classes[kXferableContractID].createInstance(kXferableIID);
+ const kXferableIID = Ci.nsITransferable;
+ var trans = Cc[kXferableContractID].createInstance(kXferableIID);
trans.init(null);
return trans;
}
};
/**
* A FlavourSet is a simple type that represents a collection of Flavour objects.
* FlavourSet is constructed from an array of Flavours, and stores this list as
@@ -246,20 +246,20 @@ function FlavourData(aData, aLength, aFl
this._XferID = "FlavourData";
}
FlavourData.prototype = {
get data ()
{
if (this.flavour &&
this.flavour.dataIIDKey != "nsISupportsString")
- return this.supports.QueryInterface(Components.interfaces[this.flavour.dataIIDKey]);
+ return this.supports.QueryInterface(Ci[this.flavour.dataIIDKey]);
var supports = this.supports;
- if (supports instanceof Components.interfaces.nsISupportsString)
+ if (supports instanceof Ci.nsISupportsString)
return supports.data.substring(0, this.contentLength/2);
return supports;
}
}
/**
* Create a TransferData object with a single FlavourData entry. Used when
@@ -275,22 +275,22 @@ var transferUtils = {
retrieveURLFromData: function (aData, flavour)
{
switch (flavour) {
case "text/unicode":
case "text/plain":
case "text/x-moz-text-internal":
return aData.replace(/^\s+|\s+$/g, "");
case "text/x-moz-url":
- return ((aData instanceof Components.interfaces.nsISupportsString) ? aData.toString() : aData).split("\n")[0];
+ return ((aData instanceof Ci.nsISupportsString) ? aData.toString() : aData).split("\n")[0];
case "application/x-moz-file":
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
var fileHandler = ioService.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
return fileHandler.getURLSpecFromFile(aData);
}
return null;
}
}
/**
@@ -321,18 +321,18 @@ var transferUtils = {
var nsDragAndDrop = {
_mDS: null,
get mDragService()
{
if (!this._mDS)
{
const kDSContractID = "@mozilla.org/widget/dragservice;1";
- const kDSIID = Components.interfaces.nsIDragService;
- this._mDS = Components.classes[kDSContractID].getService(kDSIID);
+ const kDSIID = Ci.nsIDragService;
+ this._mDS = Cc[kDSContractID].getService(kDSIID);
}
return this._mDS;
},
/**
* void startDrag (DOMEvent aEvent, Object aDragDropObserver) ;
*
* called when a drag on an element is started.
@@ -343,17 +343,17 @@ var nsDragAndDrop = {
* javascript object of format described above that specifies
* the way in which the element responds to drag events.
**/
startDrag: function (aEvent, aDragDropObserver)
{
if (!("onDragStart" in aDragDropObserver))
return;
- const kDSIID = Components.interfaces.nsIDragService;
+ const kDSIID = Ci.nsIDragService;
var dragAction = { action: kDSIID.DRAGDROP_ACTION_COPY + kDSIID.DRAGDROP_ACTION_MOVE + kDSIID.DRAGDROP_ACTION_LINK };
var transferData = { data: null };
try
{
aDragDropObserver.onDragStart(aEvent, transferData, dragAction);
}
catch (e)
@@ -370,17 +370,17 @@ var nsDragAndDrop = {
var tds = transferData._XferID == "TransferData"
? transferData
: transferData.dataList[count]
for (var i = 0; i < tds.dataList.length; ++i)
{
var currData = tds.dataList[i];
var currFlavour = currData.flavour.contentType;
var value = currData.supports;
- if (value instanceof Components.interfaces.nsISupportsString)
+ if (value instanceof Ci.nsISupportsString)
value = value.toString();
dt.mozSetDataAt(currFlavour, value, count);
}
count++;
}
while (transferData._XferID == "TransferDataSet" &&
count < transferData.dataList.length);
@@ -562,31 +562,30 @@ var nsDragAndDrop = {
// sure the source document can load the dropped URI. We don't
// so much care about creating the real URI here
// (i.e. encoding differences etc don't matter), we just want
// to know if aDraggedText really is a URI.
aDraggedText = aDraggedText.replace(/^\s*|\s*$/g, '');
var uri;
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
try {
uri = ioService.newURI(aDraggedText);
} catch (e) {
}
if (!uri)
return;
// aDraggedText is a URI, do the security check.
- const nsIScriptSecurityManager = Components.interfaces
- .nsIScriptSecurityManager;
- var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
- .getService(nsIScriptSecurityManager);
+ const nsIScriptSecurityManager = Ci.nsIScriptSecurityManager;
+ var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
+ .getService(nsIScriptSecurityManager);
if (!aDragSession)
aDragSession = this.mDragService.getCurrentSession();
var sourceDoc = aDragSession.sourceDocument;
// Use "file:///" as the default sourceURI so that drops of file:// URIs
// are always allowed.
var principal = sourceDoc ? sourceDoc.nodePrincipal
--- a/mail/base/content/phishingDetector.js
+++ b/mail/base/content/phishingDetector.js
@@ -53,24 +53,24 @@ var gPhishingDetector = {
// we are opening an .eml file.
var folder = aUrl.folder;
// Ignore nntp and RSS messages.
if (folder.server.type == 'nntp' || folder.server.type == 'rss')
return;
// Also ignore messages in Sent/Drafts/Templates/Outbox.
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
let outgoingFlags = nsMsgFolderFlags.SentMail | nsMsgFolderFlags.Drafts |
nsMsgFolderFlags.Templates | nsMsgFolderFlags.Queue;
if (folder.isSpecialFolder(outgoingFlags, true))
return;
} catch (ex) {
- if (ex.result != Components.results.NS_ERROR_FAILURE)
+ if (ex.result != Cr.NS_ERROR_FAILURE)
throw ex;
}
// extract the link nodes in the message and analyze them, looking for suspicious URLs...
var linkNodes = document.getElementById('messagepane').contentDocument.links;
for (var index = 0; index < linkNodes.length; index++)
this.analyzeUrl(linkNodes[index].href, gatherTextUnder(linkNodes[index]));
@@ -146,18 +146,18 @@ var gPhishingDetector = {
*/
reportPhishingURL: function(aPhishingURL)
{
let reportUrl = Services.urlFormatter.formatURLPref(
"browser.safebrowsing.reportPhishURL");
reportUrl += "&url=" + encodeURIComponent(aPhishingURL);
let uri = Services.io.newURI(reportUrl);
- let protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ let protocolSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
protocolSvc.loadURI(uri);
},
/**
* Private helper method to determine if the link node contains a user visible
* url with a host name that differs from the actual href the user would get
* taken to.
* i.e. <a href="http://myevilsite.com">http://mozilla.org</a>
@@ -218,17 +218,17 @@ var gPhishingDetector = {
var brandShortName = document.getElementById("bundle_brand")
.getString("brandShortName");
var bundle = document.getElementById("bundle_messenger");
var titleMsg = bundle.getString("confirmPhishingTitle");
var dialogMsg = bundle.getFormattedString("confirmPhishingUrl",
[brandShortName, unobscuredHostNameValue], 2);
- const nsIPS = Components.interfaces.nsIPromptService;
+ const nsIPS = Ci.nsIPromptService;
return !Services.prompt.confirmEx(window, titleMsg, dialogMsg,
nsIPS.STD_YES_NO_BUTTONS +
nsIPS.BUTTON_POS_1_DEFAULT,
"", "", "", "", {}); /* the yes button is in position 0 */
}
return true; // allow the link to load
}
--- a/mail/base/content/plugins.js
+++ b/mail/base/content/plugins.js
@@ -36,17 +36,17 @@ function getPluginInfo(pluginElement)
var docShell = findChildShell(doc, gBrowser.docShell, null);
try {
pluginsPage = makeURI(pluginsPage, doc.characterSet, docShell.currentURI).spec;
} catch (ex) {
pluginsPage = "";
}
}
- tagMimetype = pluginElement.QueryInterface(Components.interfaces.nsIObjectLoadingContent)
+ tagMimetype = pluginElement.QueryInterface(Ci.nsIObjectLoadingContent)
.actualType;
if (tagMimetype == "") {
tagMimetype = pluginElement.type;
}
}
return {mimetype: tagMimetype, pluginsPage: pluginsPage};
@@ -219,17 +219,17 @@ var gPluginHandler = {
},
handleEvent : function ph_handleEvent(event) {
let self = gPluginHandler;
let plugin = event.target;
let doc = plugin.ownerDocument;
// We're expecting the target to be a plugin.
- if (!(plugin instanceof Components.interfaces.nsIObjectLoadingContent))
+ if (!(plugin instanceof Ci.nsIObjectLoadingContent))
return;
let eventType = event.type;
if (eventType == "PluginBindingAttached") {
// The plugin binding fires this event when it is created.
// As an untrusted event, ensure that this object actually has a binding
// and make sure we don't handle it twice
let overlay = this.getPluginUI(plugin, "main");
@@ -460,18 +460,18 @@ var gPluginHandler = {
notificationBox.PRIORITY_WARNING_MEDIUM,
notify.buttons);
},
// Crashed-plugin observer. Notified once per plugin crash, before events
// are dispatched to individual plugin instances.
pluginCrashed : function(subject, topic, data) {
let propertyBag = subject;
- if (!(propertyBag instanceof Components.interfaces.nsIPropertyBag2) ||
- !(propertyBag instanceof Components.interfaces.nsIWritablePropertyBag2))
+ if (!(propertyBag instanceof Ci.nsIPropertyBag2) ||
+ !(propertyBag instanceof Ci.nsIWritablePropertyBag2))
return;
if (AppConstants.MOZ_CRASHREPORTER) {
let pluginDumpID = propertyBag.getPropertyAsAString("pluginDumpID");
let browserDumpID = propertyBag.getPropertyAsAString("browserDumpID");
let shouldSubmit = gCrashReporter.submitReports;
let doPrompt = true; // XXX followup to get via gCrashReporter
@@ -553,21 +553,21 @@ var gPluginHandler = {
let helpIcon = this.getPluginUI(plugin, "helpIcon");
this.addLinkClickCallback(helpIcon, "openPluginCrashHelpPage");
// If we're showing the link to manually trigger report submission, we'll
// want to be able to update all the instances of the UI for this crash to
// show an updated message when a report is submitted.
if (doPrompt) {
let observer = {
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
- Components.interfaces.nsISupportsWeakReference]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
+ Ci.nsISupportsWeakReference]),
observe : function(subject, topic, data) {
let propertyBag = subject;
- if (!(propertyBag instanceof Components.interfaces.nsIPropertyBag2))
+ if (!(propertyBag instanceof Ci.nsIPropertyBag2))
return;
// Ignore notifications for other crashes.
if (propertyBag.get("minidumpID") != pluginDumpID)
return;
statusDiv.setAttribute("status", data);
},
handleEvent : function(event) {
--- a/mail/base/content/safeMode.js
+++ b/mail/base/content/safeMode.js
@@ -6,17 +6,17 @@
ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
function restartApp() {
Services.startup.quit(Services.startup.eForceQuit | Services.startup.eRestart);
}
function deleteLocalstore() {
- var localstoreFile = Services.dirsvc.get("LStoreS", Components.interfaces.nsIFile);
+ var localstoreFile = Services.dirsvc.get("LStoreS", Ci.nsIFile);
if (localstoreFile.exists())
localstoreFile.remove(false);
// Delete the new xulstore file.
localstoreFile.leafName = "xulstore.json";
if (localstoreFile.exists())
localstoreFile.remove(false);
}
--- a/mail/base/content/sanitize.js
+++ b/mail/base/content/sanitize.js
@@ -76,18 +76,18 @@ Sanitizer.prototype = {
items: {
cache: {
clear: function ()
{
try {
// Cache doesn't consult timespan, nor does it have the
// facility for timespan-based eviction. Wipe it.
- let cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
- .getService(Ci.nsICacheStorageService);
+ let cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
+ .getService(Ci.nsICacheStorageService);
cache.clear();
} catch (ex) {}
},
get canClear()
{
return true;
@@ -127,17 +127,17 @@ Sanitizer.prototype = {
: -1;
if (!this.range || age >= 0) {
let tags = ph.getPluginTags();
for (let i = 0; i < tags.length; i++) {
try {
ph.clearSiteData(tags[i], null, FLAG_CLEAR_ALL, age);
} catch (e) {
// If the plugin doesn't support clearing by age, clear everything.
- if (e.result == Components.results.
+ if (e.result == Cr.
NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED) {
try {
ph.clearSiteData(tags[i], null, FLAG_CLEAR_ALL, -1);
} catch (e) {
// Ignore errors from the plugin
}
}
}
@@ -162,24 +162,24 @@ Sanitizer.prototype = {
clear: function ()
{
if (this.range)
PlacesUtils.history.removeVisitsByTimeframe(this.range[0], this.range[1]);
else
PlacesUtils.history.clear();
try {
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.notifyObservers(null, "browser:purge-session-history");
} catch (e) { }
try {
- var predictor = Components.classes["@mozilla.org/network/predictor;1"]
- .getService(Components.interfaces.nsINetworkPredictor);
+ var predictor = Cc["@mozilla.org/network/predictor;1"]
+ .getService(Ci.nsINetworkPredictor);
predictor.reset();
} catch (e) { }
},
get canClear()
{
// bug 347231: Always allow clearing history due to dependencies on
// the browser:purge-session-history notification. (like error console)
--- a/mail/base/content/sanitizeDialog.js
+++ b/mail/base/content/sanitizeDialog.js
@@ -102,17 +102,17 @@ var gSanitizePromptDialog = {
s.prefDomain = "privacy.cpd.";
s.range = Sanitizer.getClearRange(this.selectedTimespan);
s.ignoreTimespan = !s.range;
try {
s.sanitize();
} catch (er) {
- Components.utils.reportError("Exception during sanitize: " + er);
+ Cu.reportError("Exception during sanitize: " + er);
}
return true;
},
/**
* If the panel that displays a warning when the duration is "Everything" is
* not set up, sets it up. Otherwise does nothing.
*
--- a/mail/base/content/search.xml
+++ b/mail/base/content/search.xml
@@ -65,19 +65,19 @@
.replace("#1", this.getAttribute(
(AppConstants.platform == "macosx") ?
"keyLabelMac" : "keyLabelNonMac")));
Services.prefs.addObserver("mailnews.database.global.indexer.enabled",
this._prefObserver);
this.glodaCompleter =
- Components.classes["@mozilla.org/autocomplete/search;1?name=gloda"]
- .getService()
- .wrappedJSObject;
+ Cc["@mozilla.org/autocomplete/search;1?name=gloda"]
+ .getService()
+ .wrappedJSObject;
Services.obs.addObserver(this, "autocomplete-did-enter-text");
this.glodaEnabled =
Services.prefs.getBoolPref("mailnews.database.global.indexer.enabled");
this.collapsed = !this.glodaEnabled;
// make sure we set our emptytext here from the get-go
if (this.hasAttribute("placeholder"))
--- a/mail/base/content/selectionsummaries.js
+++ b/mail/base/content/selectionsummaries.js
@@ -53,17 +53,17 @@ function summarizeThread(aSelectedMessag
aMessageDisplay.singleMessageDisplay = false;
gSummaryFrameManager.loadAndCallback(kSummaryURL, function() {
let childWindow = gSummaryFrameManager.iframe.contentWindow;
try {
childWindow.gMessageSummary.summarize(
"thread", aSelectedMessages, aMessageDisplay
);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
throw e;
}
});
}
/**
* Given an array of message URIs, cause the message panel to display a summary
* of them.
@@ -78,17 +78,17 @@ function summarizeMultipleSelection(aSel
aMessageDisplay.singleMessageDisplay = false;
gSummaryFrameManager.loadAndCallback(kSummaryURL, function() {
let childWindow = gSummaryFrameManager.iframe.contentWindow;
try {
childWindow.gMessageSummary.summarize(
"multipleselection", aSelectedMessages, aMessageDisplay
);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
throw e;
}
});
}
/**
* Summarize a message folder; this is mainly a stub function for extensions to
* override. It currently only shows the start page.
--- a/mail/base/content/specialTabs.js
+++ b/mail/base/content/specialTabs.js
@@ -61,17 +61,17 @@ tabProgressListener.prototype =
aLocationURI, aFlags);
// onLocationChange is called for both the top-level content
// and the subframes.
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow) {
// Don't clear the favicon if this onLocationChange was triggered
// by a pushState or a replaceState. See bug 550565.
if (aWebProgress.isLoadingDocument &&
!(this.mBrowser.docShell.loadType &
- Components.interfaces.nsIDocShell.LOAD_CMD_PUSHSTATE))
+ Ci.nsIDocShell.LOAD_CMD_PUSHSTATE))
this.mBrowser.mIconURL = null;
var location = aLocationURI ? aLocationURI.spec : "";
// Set the reload command only if this is a report that is coming in about
// the top-level content location change.
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow) {
// Although we're unlikely to be loading about:blank, we'll check it
@@ -89,18 +89,18 @@ tabProgressListener.prototype =
this.mProgressListener.onStateChange(aWebProgress, aRequest, aStateFlags,
aStatus);
if (!aRequest)
return;
var oldBlank = this.mBlank;
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
- const nsIChannel = Components.interfaces.nsIChannel;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
+ const nsIChannel = Ci.nsIChannel;
let tabmail = document.getElementById("tabmail");
if (aStateFlags & nsIWebProgressListener.STATE_START) {
this.mRequestCount++;
}
else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
// Since we (try to) only handle STATE_STOP of the last request,
// the count of open requests should now be 0.
@@ -148,19 +148,19 @@ tabProgressListener.prototype =
this.mProgressListener.onSecurityChange(aWebProgress, aRequest, aState);
},
onRefreshAttempted: function tPL_OnRefreshAttempted(aWebProgress, aURI,
aDelay, aSameURI) {
if (this.mProgressListener)
this.mProgressListener.onRefreshAttempted(aWebProgress, aURI, aDelay,
aSameURI);
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIWebProgressListener,
- Components.interfaces.nsIWebProgressListener2,
- Components.interfaces.nsISupportsWeakReference])
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
+ Ci.nsIWebProgressListener2,
+ Ci.nsISupportsWeakReference])
};
var DOMLinkHandler = {
handleEvent: function (event) {
switch (event.type) {
case "DOMLinkAdded":
this.onLinkAdded(event);
break;
@@ -192,27 +192,27 @@ var DOMLinkHandler = {
"about:certerror?"
].some(function (aStart) { targetDoc.documentURI.startsWith(aStart); });
if (!isAllowedPage || !uri.schemeIs("chrome")) {
// Be extra paraniod and just make sure we're not going to load
// something we shouldn't. Firefox does this, so we're doing the same.
try {
Services.scriptSecurityManager.checkLoadURIWithPrincipal(targetDoc.nodePrincipal, uri,
- Components.interfaces.nsIScriptSecurityManager.DISALLOW_SCRIPT);
+ Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
}
catch (ex) {
return;
}
}
- const nsIContentPolicy = Components.interfaces.nsIContentPolicy;
+ const nsIContentPolicy = Ci.nsIContentPolicy;
try {
- var contentPolicy = Components.classes["@mozilla.org/layout/content-policy;1"]
+ var contentPolicy = Cc["@mozilla.org/layout/content-policy;1"]
.getService(nsIContentPolicy);
}
catch (e) {
// Refuse to load if we can't do a security check.
return;
}
// Security says okay, now ask content policy. This is probably trying to
@@ -445,25 +445,25 @@ var contentTabBaseType = {
},
};
var specialTabs = {
_kAboutRightsVersion: 1,
get _protocolSvc() {
delete this._protocolSvc;
return this._protocolSvc =
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
},
get mFaviconService() {
delete this.mFaviconService;
return this.mFaviconService =
- Components.classes["@mozilla.org/browser/favicon-service;1"]
- .getService(Components.interfaces.nsIFaviconService);
+ Cc["@mozilla.org/browser/favicon-service;1"]
+ .getService(Ci.nsIFaviconService);
},
/**
* We use an html image node to test the favicon, errors are well returned.
* Returning a url for nsITreeView.getImageSrc() will not indicate any
* error, and setAndFetchFaviconForPage() can't be used to detect
* failed icons due to Bug 740457. This also ensures 301 Moved or
* redirected urls will work (they won't otherwise in getImageSrc).
@@ -567,29 +567,29 @@ var specialTabs = {
let browser = document.getElementById("dummycontentbrowser");
// Manually hook up session and global history for the first browser
// so that we don't have to load global history before bringing up a
// window.
// Wire up session and global history before any possible
// progress notifications for back/forward button updating
browser.webNavigation.sessionHistory =
- Components.classes["@mozilla.org/browser/shistory;1"]
- .createInstance(Components.interfaces.nsISHistory);
+ Cc["@mozilla.org/browser/shistory;1"]
+ .createInstance(Ci.nsISHistory);
Services.obs.addObserver(browser, "browser:purge-session-history");
// remove the disablehistory attribute so the browser cleans up, as
// though it had done this work itself
browser.removeAttribute("disablehistory");
// enable global history
try {
browser.docShell.useGlobalHistory = true;
} catch(ex) {
- Components.utils.reportError("Places database may be locked: " + ex);
+ Cu.reportError("Places database may be locked: " + ex);
}
Services.obs.addObserver(specialTabs, "mail-startup-done");
let tabmail = document.getElementById('tabmail');
tabmail.registerTabType(this.contentTabType);
tabmail.registerTabType(this.chromeTabType);
@@ -715,25 +715,25 @@ var specialTabs = {
if ("onLoad" in aArgs) {
aTab.browser.addEventListener("load", function _contentTab_onLoad (event) {
aArgs.onLoad(event, aTab.browser);
aTab.browser.removeEventListener("load", _contentTab_onLoad, true);
}, true);
}
// Create a filter and hook it up to our browser
- let filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
- .createInstance(Components.interfaces.nsIWebProgress);
+ let filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
+ .createInstance(Ci.nsIWebProgress);
aTab.filter = filter;
- aTab.browser.webProgress.addProgressListener(filter, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
+ aTab.browser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
// Wire up a progress listener to the filter for this browser
aTab.progressListener = new tabProgressListener(aTab, false);
- filter.addProgressListener(aTab.progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
+ filter.addProgressListener(aTab.progressListener, Ci.nsIWebProgress.NOTIFY_ALL);
if ("onListener" in aArgs)
aArgs.onListener(aTab.browser, aTab.progressListener);
// Initialize our unit testing variables.
aTab.pageLoading = false;
aTab.pageLoaded = false;
@@ -813,23 +813,23 @@ var specialTabs = {
return [this.splitVersion(savedAppVersion), this.splitVersion(currentApplicationVersion)];
},
/**
* Shows the what's new page in a content tab.
*/
showWhatsNewPage: function onShowWhatsNewPage() {
- let um = Components.classes["@mozilla.org/updates/update-manager;1"]
- .getService(Components.interfaces.nsIUpdateManager);
+ let um = Cc["@mozilla.org/updates/update-manager;1"]
+ .getService(Ci.nsIUpdateManager);
try {
// If the updates.xml file is deleted then getUpdateAt will throw.
var update = um.getUpdateAt(0)
- .QueryInterface(Components.interfaces.nsIPropertyBag);
+ .QueryInterface(Ci.nsIPropertyBag);
} catch (x) {
Cu.reportError("Unable to find update: " + x);
return;
}
let actions = update.getProperty("actions");
if (actions && actions.includes("silent"))
return;
--- a/mail/base/content/systemIntegrationDialog.js
+++ b/mail/base/content/systemIntegrationDialog.js
@@ -1,18 +1,18 @@
/* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This dialog can only be opened if we have a shell service.
var gSystemIntegrationDialog = {
- _shellSvc: Components.classes["@mozilla.org/mail/shell-service;1"]
- .getService(Components.interfaces.nsIShellService),
+ _shellSvc: Cc["@mozilla.org/mail/shell-service;1"]
+ .getService(Ci.nsIShellService),
_mailCheckbox: null,
_newsCheckbox: null,
_rssCheckbox: null,
_startupCheckbox: null,
--- a/mail/base/content/tabmail.xml
+++ b/mail/base/content/tabmail.xml
@@ -913,17 +913,17 @@
// logic fails, things like tab closure still run to completion.
try {
tabState = persistFunc.call(tab.mode.tabType, tab);
}
catch(ex) {
// Report this so that our unit testing framework sees this
// error and (extension) developers likewise can see when their
// extensions are ill-behaved.
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
if (!tabState)
return null;
let ext = {};
for (let tabMonitor of this.tabMonitors) {
@@ -1978,24 +1978,24 @@
// only start the flash timer if the new tab (which was loaded in
// the background) is not completely visible
if (tsboStart > ctboStart || ctboEnd > tsboEnd) {
this._animateStep = 0;
if (!this._animateTimer)
this._animateTimer =
- Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
else
this._animateTimer.cancel();
this._animateTimer.initWithCallback(this,
this._animateDelay,
- Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
+ Ci.nsITimer.TYPE_REPEATING_SLACK);
}
]]></body>
</method>
<method name="notify">
<parameter name="aTimer"/>
<body><![CDATA[
if (!document)
@@ -2416,22 +2416,22 @@
null
</field>
<constructor><![CDATA[
// We cannot cache the XULBrowserWindow object itself since it might
// be set after this binding is constructed.
try {
this._xulWindow =
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIXULWindow);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIXULWindow);
}
catch(ex) { }
let tabmailalltabspopup = this;
this._mutationObserver = new MutationObserver(function handleMutations(aRecords, aObserver) {
aRecords.forEach(function(mutation) {
let menuItem = mutation.target.mCorrespondingMenuitem;
if (menuItem)
--- a/mail/base/content/threadPane.js
+++ b/mail/base/content/threadPane.js
@@ -131,23 +131,23 @@ function HandleColumnClick(columnID)
}
else {
MsgSortThreadPane(sortType);
}
}
function ThreadPaneDoubleClick()
{
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
if (IsSpecialFolderSelected(nsMsgFolderFlags.Drafts, true)) {
MsgComposeDraftMessage();
}
else if(IsSpecialFolderSelected(nsMsgFolderFlags.Templates, true)) {
- ComposeMessage(Components.interfaces.nsIMsgCompType.Template,
- Components.interfaces.nsIMsgCompFormat.Default,
+ ComposeMessage(Ci.nsIMsgCompType.Template,
+ Ci.nsIMsgCompFormat.Default,
gFolderDisplay.displayedFolder,
gFolderDisplay.selectedMessageUris);
}
else {
MsgOpenSelectedMessages();
}
}
--- a/mail/base/content/utilityOverlay.js
+++ b/mail/base/content/utilityOverlay.js
@@ -50,22 +50,22 @@ function goUpdatePasteMenuItems()
function goCopyImage() {
let img = document.popupNode;
if (/^(https?|data):/i.test(img.src)) {
goDoCommand("cmd_copyImage");
return;
}
// A mailbox/imap URL then... copy only data then since the HTML data is
// not that useful for pasting when the image won't be resolved.
- let param = Components.classes["@mozilla.org/embedcomp/command-params;1"]
- .createInstance(Components.interfaces.nsICommandParams);
+ let param = Cc["@mozilla.org/embedcomp/command-params;1"]
+ .createInstance(Ci.nsICommandParams);
param.setLongValue("imageCopy",
- Components.interfaces.nsIContentViewerEdit.COPY_IMAGE_DATA);
+ Ci.nsIContentViewerEdit.COPY_IMAGE_DATA);
document.commandDispatcher.getControllerForCommand("cmd_copyImage")
- .QueryInterface(Components.interfaces.nsICommandController)
+ .QueryInterface(Ci.nsICommandController)
.doCommandWithParams("cmd_copyImage", param);
}
// update Find As You Type menu items, they rely on focus
function goUpdateFindTypeMenuItems()
{
goUpdateCommand('cmd_findTypeText');
goUpdateCommand('cmd_findTypeLinks');
@@ -188,17 +188,17 @@ function togglePaneSplitter(splitterId)
// We currently only react to left click in Thunderbird.
function openUILink(url, event)
{
if (!event.button) {
PlacesUtils.asyncHistory.updatePlaces({
uri: makeURI(url),
visits: [{
visitDate: Date.now() * 1000,
- transitionType: Components.interfaces.nsINavHistoryService.TRANSITION_LINK
+ transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
}]
});
messenger.launchExternalURL(url);
}
}
function openWhatsNew()
{
--- a/mail/base/modules/dbViewWrapper.js
+++ b/mail/base/modules/dbViewWrapper.js
@@ -652,17 +652,17 @@ DBViewWrapper.prototype = {
doppel.displayedFolder,
doppel);
// -- clone the view
if (this.dbView)
doppel.dbView = this.dbView.cloneDBView(aListener.messenger,
aListener.msgWindow,
aListener.threadPaneCommandUpdater)
- .QueryInterface(Components.interfaces.nsITreeView);
+ .QueryInterface(Ci.nsITreeView);
// -- clone the search
if (this.search)
doppel.search = this.search.clone(doppel);
if (doppel._underlyingData == this.kUnderlyingSearchView ||
doppel._underlyingData == this.kUnderlyingSynthetic)
FolderNotificationHelper.noteCuriosity(doppel);
--- a/mail/base/modules/displayNameUtils.js
+++ b/mail/base/modules/displayNameUtils.js
@@ -24,32 +24,32 @@ var gMessengerBundle = new StringBundle(
* @param aEmailAddress The address to look for.
* @return An object with two properties, .book and .card.
*/
function GetCardForEmail(aEmailAddress) {
// Email address is searched for in any of the address books that support
// the cardForEmailAddress function.
// Future expansion could be to domain matches
let books = MailServices.ab.directories;
- for (let book of fixIterator(books, Components.interfaces.nsIAbDirectory)) {
+ for (let book of fixIterator(books, Ci.nsIAbDirectory)) {
try {
let card = book.cardForEmailAddress(aEmailAddress);
if (card)
return { book: book, card: card };
}
catch (ex) {}
}
return { book: null, card: null };
}
function _getIdentityForAddress(aEmailAddress) {
let emailAddress = aEmailAddress.toLowerCase();
for (let identity of fixIterator(MailServices.accounts.allIdentities,
- Components.interfaces.nsIMsgIdentity)) {
+ Ci.nsIMsgIdentity)) {
if (!identity.email)
continue;
if (emailAddress == identity.email.toLowerCase())
return identity;
}
return null;
}
--- a/mail/base/modules/mailMigrator.js
+++ b/mail/base/modules/mailMigrator.js
@@ -314,17 +314,17 @@ var MailMigrator = {
Services.prefs.getBoolPref("editor.CR_creates_new_p"));
Services.prefs.clearUserPref("editor.CR_creates_new_p");
}
// Migrate remote content exceptions for email addresses which are
// encoded as chrome URIs.
if (currentUIVersion < 14) {
let permissionsDB =
- Services.dirsvc.get("ProfD",Components.interfaces.nsIFile);
+ Services.dirsvc.get("ProfD",Ci.nsIFile);
permissionsDB.append("permissions.sqlite");
let db = Services.storage.openDatabase(permissionsDB);
try {
let statement = db.createStatement(
"select origin,permission from moz_perms where " +
// Avoid 'like' here which needs to be escaped.
"substr(origin, 1, 28)='chrome://messenger/content/?';");
@@ -340,18 +340,18 @@ var MailMigrator = {
Services.io.newURI(origin), "image", permission);
}
} finally {
statement.finalize();
}
// Sadly we still need to clear the database manually. Experiments
// showed that the permissions manager deleted only one record.
- db.beginTransactionAs(Components.interfaces.mozIStorageConnection
- .TRANSACTION_EXCLUSIVE);
+ db.beginTransactionAs(Ci.mozIStorageConnection
+ .TRANSACTION_EXCLUSIVE);
try {
db.executeSimpleSQL("delete from moz_perms where " +
"substr(origin, 1, 28)='chrome://messenger/content/?';");
db.commitTransaction();
} catch (ex) {
db.rollbackTransaction();
throw ex;
}
--- a/mail/base/modules/mailViewManager.js
+++ b/mail/base/modules/mailViewManager.js
@@ -36,17 +36,17 @@ var MailViewConstants = {
* MailViews are view 'filters' implemented using search terms. DBViewWrapper
* uses the SearchSpec class to combine the search terms of the mailview with
* those of the virtual folder (if applicable) and the quicksearch (if
* applicable).
*/
var MailViewManager = {
_views: {},
_customMailViews: Cc["@mozilla.org/messenger/mailviewlist;1"]
- .getService(Components.interfaces.nsIMsgMailViewList),
+ .getService(Ci.nsIMsgMailViewList),
/**
* Define one of the built-in mail-views. If you want to define your own
* view, you need to define a custom view using nsIMsgMailViewList.
*
* We define our own little view definition abstraction because some day this
* functionality may want to be generalized to be usable by gloda as well.
*
--- a/mail/base/modules/quickFilterManager.js
+++ b/mail/base/modules/quickFilterManager.js
@@ -9,19 +9,19 @@ ChromeUtils.import("resource://gre/modul
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
ChromeUtils.import("resource:///modules/errUtils.js");
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource:///modules/searchSpec.js");
-var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
-var nsMsgMessageFlags = Components.interfaces.nsMsgMessageFlags;
-var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
+var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
+var nsMsgMessageFlags = Ci.nsMsgMessageFlags;
+var nsMsgSearchOp = Ci.nsMsgSearchOp;
// XXX we need to know whether the gloda indexer is enabled for upsell reasons,
// but this should really just be exposed on the main Gloda public interface.
ChromeUtils.import("resource:///modules/gloda/indexer.js");
// we need to be able to create gloda message searcher instances for upsells:
ChromeUtils.import("resource:///modules/gloda/msg_search.js");
@@ -584,20 +584,20 @@ QuickFilterManager.defineFilter({
domId: "qfb-inaddrbook",
appendTerms: function(aTermCreator, aTerms, aFilterValue) {
let term, value;
let enumerator = MailServices.ab.directories;
let firstBook = true;
term = null;
while (enumerator.hasMoreElements()) {
let addrbook = enumerator.getNext();
- if (addrbook instanceof Components.interfaces.nsIAbDirectory &&
+ if (addrbook instanceof Ci.nsIAbDirectory &&
!addrbook.isRemote) {
term = aTermCreator.createTerm();
- term.attrib = Components.interfaces.nsMsgSearchAttrib.Sender;
+ term.attrib = Ci.nsMsgSearchAttrib.Sender;
value = term.value;
value.attrib = term.attrib;
value.str = addrbook.URI;
term.value = value;
term.op = aFilterValue ? nsMsgSearchOp.IsInAB : nsMsgSearchOp.IsntInAB;
// It's an AND if we're the first book (so the boolean affects the
// group as a whole.)
// It's the negation of whether we're filtering otherwise; demorgans.
@@ -657,23 +657,23 @@ var TagFacetingFilter = {
if (aFilterValue == null)
return null;
let term, value;
// just the true/false case
if (this.isSimple(aFilterValue)) {
term = aTermCreator.createTerm();
- term.attrib = Components.interfaces.nsMsgSearchAttrib.Keywords;
+ term.attrib = Ci.nsMsgSearchAttrib.Keywords;
value = term.value;
value.str = "";
term.value = value;
term.op = aFilterValue ?
- Components.interfaces.nsMsgSearchOp.IsntEmpty :
- Components.interfaces.nsMsgSearchOp.IsEmpty;
+ Ci.nsMsgSearchOp.IsntEmpty :
+ Ci.nsMsgSearchOp.IsEmpty;
term.booleanAnd = true;
aTerms.push(term);
// we need to perform faceting if the value is literally true.
if (aFilterValue === true)
return this;
}
else {
@@ -683,17 +683,17 @@ var TagFacetingFilter = {
let excludeTerms = [];
let mode = aFilterValue.mode;
for (let key in aFilterValue.tags) {
let shouldFilter = aFilterValue.tags[key];
if (shouldFilter !== null) {
term = aTermCreator.createTerm();
- term.attrib = Components.interfaces.nsMsgSearchAttrib.Keywords;
+ term.attrib = Ci.nsMsgSearchAttrib.Keywords;
value = term.value;
value.attrib = term.attrib;
value.str = key;
term.value = value;
if (shouldFilter) {
term.op = nsMsgSearchOp.Contains;
// AND for the group. Inside the group we also want AND if the
// mode is set to "All of".
@@ -719,21 +719,21 @@ var TagFacetingFilter = {
// if we have any exclude terms:
// - we might need to add a "has a tag" clause if there were no explicit
// inclusions.
// - extend the exclusions list in.
if (excludeTerms.length) {
// (we need to add has a tag)
if (!lastIncludeTerm) {
term = aTermCreator.createTerm();
- term.attrib = Components.interfaces.nsMsgSearchAttrib.Keywords;
+ term.attrib = Ci.nsMsgSearchAttrib.Keywords;
value = term.value;
value.str = "";
term.value = value;
- term.op = Components.interfaces.nsMsgSearchOp.IsntEmpty;
+ term.op = Ci.nsMsgSearchOp.IsntEmpty;
term.booleanAnd = true;
aTerms.push(term);
}
// (extend in the exclusions)
excludeTerms[excludeTerms.length-1].endsGrouping = true;
aTerms.push.apply(aTerms, excludeTerms);
}
@@ -911,20 +911,20 @@ QuickFilterManager.defineFilter(TagFacet
* true: must have attachment, false: must not have attachment.
*/
QuickFilterManager.defineFilter({
name: "attachment",
domId: "qfb-attachment",
appendTerms: function(aTermCreator, aTerms, aFilterValue) {
let term, value;
term = aTermCreator.createTerm();
- term.attrib = Components.interfaces.nsMsgSearchAttrib.MsgStatus;
+ term.attrib = Ci.nsMsgSearchAttrib.MsgStatus;
value = term.value;
value.attrib = term.attrib;
- value.status = Components.interfaces.nsMsgMessageFlags.Attachment;
+ value.status = Ci.nsMsgMessageFlags.Attachment;
term.value = value;
term.op = aFilterValue ? nsMsgSearchOp.Is : nsMsgSearchOp.Isnt;
term.booleanAnd = true;
aTerms.push(term);
}
});
/**
--- a/mail/base/modules/searchSpec.js
+++ b/mail/base/modules/searchSpec.js
@@ -68,18 +68,18 @@ SearchSpec.prototype = {
*
* Code should only access this attribute when it wants to manipulate the
* session. Callers should use hasSearchTerms if they want to determine if
* a search session is required.
*/
get session() {
if (this._session == null) {
this._session =
- Components.classes["@mozilla.org/messenger/searchSession;1"]
- .createInstance(Ci.nsIMsgSearchSession);
+ Cc["@mozilla.org/messenger/searchSession;1"]
+ .createInstance(Ci.nsIMsgSearchSession);
}
return this._session;
},
/**
* (Potentially) add the db view as a search listener and kick off the search.
* We only do that if we have search terms. The intent is to allow you to
* call this all the time, even if you don't need to.
@@ -197,17 +197,17 @@ SearchSpec.prototype = {
*
* @param aTerms The search terms
* @param aCloneTerms Do we need to clone the terms?
*/
_groupifyTerms: function SearchSpec__groupifyTerms(aTerms, aCloneTerms) {
let term;
let outTerms = aCloneTerms ? [] : aTerms;
let inGroup = false;
- for (term of fixIterator(aTerms, Components.interfaces.nsIMsgSearchTerm)) {
+ for (term of fixIterator(aTerms, Ci.nsIMsgSearchTerm)) {
// If we're in a group, all that is forbidden is the creation of new
// groups.
if (inGroup) {
if (term.beginsGrouping) // forbidden!
return this._flattenGroupifyTerms(aTerms, aCloneTerms);
else if (term.endsGrouping)
inGroup = false;
}
--- a/mail/base/modules/summaryFrameManager.js
+++ b/mail/base/modules/summaryFrameManager.js
@@ -77,19 +77,19 @@ SummaryFrameManager.prototype = {
// some subnode.
if (event.originalTarget != this.iframe.contentDocument ||
this.pendingOrLoadedUrl == "about:blank")
return;
this.callback = this.pendingCallback;
this.pendingCallback = null;
if (this.pendingOrLoadedUrl != this.iframe.contentDocument.location.href)
- Components.utils.reportError(
+ Cu.reportError(
"Please do not load stuff in the multimessage browser directly, "+
"use the SummaryFrameManager instead.");
else if (this.callback)
this.callback(true);
}
catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
};
--- a/mail/base/test/unit/resources/viewWrapperTestUtils.js
+++ b/mail/base/test/unit/resources/viewWrapperTestUtils.js
@@ -342,26 +342,26 @@ function dump_view_state(aViewWrapper, a
dump("no nsIMsgDBView instance!\n");
return;
}
if (!aDoNotDumpContents)
dump_view_contents(aViewWrapper);
dump("View: " + aViewWrapper.dbView + "\n");
dump(" View Type: " +
_lookupValueNameInInterface(aViewWrapper.dbView.viewType,
- Components.interfaces.nsMsgViewType) +
+ Ci.nsMsgViewType) +
" " +
"View Flags: " + aViewWrapper.dbView.viewFlags + "\n");
dump(" Sort Type: " +
_lookupValueNameInInterface(aViewWrapper.dbView.sortType,
- Components.interfaces.nsMsgViewSortType) +
+ Ci.nsMsgViewSortType) +
" " +
"Sort Order: " +
_lookupValueNameInInterface(aViewWrapper.dbView.sortOrder,
- Components.interfaces.nsMsgViewSortOrder) +
+ Ci.nsMsgViewSortOrder) +
"\n");
dump(aViewWrapper.search.prettyString());
}
/**
* Verify that the messages in the provided SyntheticMessageSets are the only
* visible messages in the provided DBViewWrapper. If dummy headers are present
--- a/mail/base/test/unit/test_mailGlue_distribution.js
+++ b/mail/base/test/unit/test_mailGlue_distribution.js
@@ -58,17 +58,17 @@ function run_test()
pref = Services.prefs.getCharPref("distribution.version");
Assert.equal(iniValue, pref);
let aboutLocale;
try {
aboutLocale = testIni.getString("Global", "about.en-US");
}
catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
if (aboutLocale == undefined)
aboutLocale = testIni.getString("Global", "about");
pref = Services.prefs.getCharPref("distribution.about");
Assert.equal(aboutLocale, pref);
--- a/mail/base/test/unit/test_viewWrapper_virtualFolderCustomTerm.js
+++ b/mail/base/test/unit/test_viewWrapper_virtualFolderCustomTerm.js
@@ -29,17 +29,17 @@ var gCustomSearchTermSubject = {
getEnabled: function subject_getEnabled(scope, op) {
return true;
},
getAvailable: function subject_getAvailable(scope, op) {
return true;
},
getAvailableOperators: function subject_getAvailableOperators(scope, length) {
length.value = 1;
- return [Components.interfaces.nsMsgSearchOp.Contains];
+ return [Ci.nsMsgSearchOp.Contains];
},
match: function subject_match(aMsgHdr, aSearchValue, aSearchOp) {
return (aMsgHdr.subject.includes(aSearchValue));
},
needsBody: false,
};
MailServices.filters.addCustomTerm(gCustomSearchTermSubject);
--- a/mail/base/test/unit/test_windows_font_migration.js
+++ b/mail/base/test/unit/test_windows_font_migration.js
@@ -35,18 +35,18 @@ var kSizesToVerify = ["variableSize", "f
*/
function makeVerifier(aFonts) {
function getFont(aFontType, aEncoding) {
var font = Services.prefs.getCharPref("font.name." + aFontType + "." + aEncoding);
if (font)
return font;
// Get the default.
- var enumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
- .createInstance(Components.interfaces.nsIFontEnumerator);
+ var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
+ .createInstance(Ci.nsIFontEnumerator);
var fonts = enumerator.EnumerateFonts(aEncoding, aFontType, {});
var defaultFont = null;
if (fonts.length > 0)
defaultFont = enumerator.getDefaultFont(aEncoding, aFontType);
return defaultFont;
}
function verifier(aEncoding, aNonDefaultFonts) {
--- a/mail/components/about-support/content/aboutSupport.js
+++ b/mail/components/about-support/content/aboutSupport.js
@@ -151,17 +151,17 @@ var snapshotFormatters = {
let bundle = Services.strings.createBundle(
"chrome://messenger/locale/aboutSupportMail.properties");
let fsText = bundle.GetStringFromName("fsType." + fsType);
let fsTextNode = document.createElement("span");
fsTextNode.textContent = fsText;
profElem.appendChild(fsTextNode);
}
catch (x) {
- Components.utils.reportError(x);
+ Cu.reportError(x);
}
// end of TB addition
},
crashes: function crashes(data) {
if (!AppConstants.MOZ_CRASHREPORTER)
return;
--- a/mail/components/about-support/content/accounts.js
+++ b/mail/components/about-support/content/accounts.js
@@ -114,17 +114,17 @@ var AboutSupport = {
let plainSocketType = (aIndex in gSocketTypes ?
gSocketTypes[aIndex] : aIndex);
let prettySocketType;
try {
prettySocketType = gMessengerBundle.GetStringFromName(
"smtpServer-ConnectionSecurityType-" + aIndex);
}
catch (e) {
- if (e.result == Components.results.NS_ERROR_FAILURE) {
+ if (e.result == Cr.NS_ERROR_FAILURE) {
// The string wasn't found in the bundle. Make do without it.
prettySocketType = plainSocketType;
} else {
throw e;
}
}
return {localized: prettySocketType, neutral: plainSocketType};
},
--- a/mail/components/aboutRedirector.js
+++ b/mail/components/aboutRedirector.js
@@ -34,24 +34,24 @@ AboutRedirector.prototype = {
// Strip out the first ? or #, and anything following it
let name = (/[^?#]+/.exec(aURI.pathQueryRef))[0];
return name.toLowerCase();
},
getURIFlags: function(aURI) {
let name = this._getModuleName(aURI);
if (!(name in this._redirMap))
- throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+ throw Cr.NS_ERROR_ILLEGAL_VALUE;
return this._redirMap[name].flags;
},
newChannel: function(aURI, aLoadInfo) {
let name = this._getModuleName(aURI);
if (!(name in this._redirMap))
- throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+ throw Cr.NS_ERROR_ILLEGAL_VALUE;
let newURI = Services.io.newURI(this._redirMap[name].url);
let channel = Services.io.newChannelFromURIWithLoadInfo(newURI, aLoadInfo);
channel.originalURI = aURI;
if (this._redirMap[name].flags & Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT) {
let principal = Services.scriptSecurityManager.createCodebasePrincipal(aURI, {});
channel.owner = principal;
--- a/mail/components/accountcreation/content/MyBadCertHandler.js
+++ b/mail/components/accountcreation/content/MyBadCertHandler.js
@@ -27,15 +27,15 @@ BadCertHandler.prototype =
// nsIInterfaceRequestor
getInterface: function(iid) {
return this.QueryInterface(iid);
},
// nsISupports
QueryInterface: function(iid) {
- if (!iid.equals(Components.interfaces.nsIBadCertListener2) &&
- !iid.equals(Components.interfaces.nsIInterfaceRequestor) &&
- !iid.equals(Components.interfaces.nsISupports))
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ if (!iid.equals(Ci.nsIBadCertListener2) &&
+ !iid.equals(Ci.nsIInterfaceRequestor) &&
+ !iid.equals(Ci.nsISupports))
+ throw Cr.NS_ERROR_NO_INTERFACE;
return this;
}
};
--- a/mail/components/accountcreation/content/createInBackend.js
+++ b/mail/components/accountcreation/content/createInBackend.js
@@ -218,19 +218,19 @@ function setFolders(identity, server)
identity.fccFolderPickerMode = 0;
identity.draftsFolderPickerMode = 0;
identity.tmplFolderPickerMode = 0;
}
function rememberPassword(server, password)
{
- if (server instanceof Components.interfaces.nsIMsgIncomingServer)
+ if (server instanceof Ci.nsIMsgIncomingServer)
var passwordURI = server.localStoreType + "://" + server.hostName;
- else if (server instanceof Components.interfaces.nsISmtpServer)
+ else if (server instanceof Ci.nsISmtpServer)
var passwordURI = "smtp://" + server.hostname;
else
throw new NotReached("Server type not supported");
let login = Cc["@mozilla.org/login-manager/loginInfo;1"]
.createInstance(Ci.nsILoginInfo);
login.init(passwordURI, null, passwordURI, server.username, password, "", "");
try {
--- a/mail/components/accountcreation/content/guessConfig.js
+++ b/mail/components/accountcreation/content/guessConfig.js
@@ -1132,14 +1132,14 @@ function SocketAbortable(transport)
assert(transport instanceof Ci.nsITransport, "need transport");
this._transport = transport;
}
SocketAbortable.prototype = Object.create(Abortable.prototype);
SocketAbortable.prototype.constructor = UserCancelledException;
SocketAbortable.prototype.cancel = function(ex)
{
try {
- this._transport.close(Components.results.NS_ERROR_ABORT);
+ this._transport.close(Cr.NS_ERROR_ABORT);
} catch (e) {
ddump("canceling socket failed: " + e);
}
}
--- a/mail/components/accountcreation/content/verifyConfig.js
+++ b/mail/components/accountcreation/content/verifyConfig.js
@@ -331,17 +331,17 @@ urlListener.prototype =
// nsIInterfaceRequestor
getInterface: function(iid) {
return this.QueryInterface(iid);
},
// nsISupports
QueryInterface: function(iid) {
- if (!iid.equals(Components.interfaces.nsIBadCertListener2) &&
- !iid.equals(Components.interfaces.nsIInterfaceRequestor) &&
- !iid.equals(Components.interfaces.nsIUrlListener) &&
- !iid.equals(Components.interfaces.nsISupports))
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ if (!iid.equals(Ci.nsIBadCertListener2) &&
+ !iid.equals(Ci.nsIInterfaceRequestor) &&
+ !iid.equals(Ci.nsIUrlListener) &&
+ !iid.equals(Ci.nsISupports))
+ throw Cr.NS_ERROR_NO_INTERFACE;
return this;
}
}
--- a/mail/components/activity/content/activity.js
+++ b/mail/components/activity/content/activity.js
@@ -97,18 +97,18 @@ var activityObject =
addActivityBinding: function(aID, aActivity) {
try {
this._activityLogger.info("Adding ActivityBinding: " + aID + ", " +
aActivity)
// get |groupingStyle| of the activity. Grouping style determines
// whether we show the activity standalone or grouped by context in
// the activity manager window.
let isGroupByContext = (aActivity.groupingStyle ==
- Components.interfaces.nsIActivity
- .GROUPING_STYLE_BYCONTEXT);
+ Ci.nsIActivity
+ .GROUPING_STYLE_BYCONTEXT);
// find out if an activity group has already been created for this context
let group = null;
if (isGroupByContext) {
group = this.getActivityGroupBindingByContext(aActivity.contextType,
aActivity.contextObj);
// create a group if it's not already created.
if (!group) {
@@ -197,19 +197,18 @@ var activityObject =
//////////////////////////////////////////////////////////////////////////////
//// Startup, Shutdown
startup: function() {
try {
this._activitiesView = document.getElementById("activityView");
- let activityManager = Components
- .classes["@mozilla.org/activity-manager;1"]
- .getService(Components.interfaces.nsIActivityManager);
+ let activityManager = Cc["@mozilla.org/activity-manager;1"]
+ .getService(Ci.nsIActivityManager);
let activities = activityManager.getActivities({});
for (let iActivity = Math.max(0, activities.length - ACTIVITY_LIMIT);
iActivity < activities.length; iActivity++) {
let activity = activities[iActivity];
this.addActivityBinding(activity.id, activity);
}
// start listening changes in the activity manager's
@@ -218,45 +217,45 @@ var activityObject =
activityManager.addListener(this._activityMgrListener);
} catch (e) {
this._activityLogger.error("Exception: " + e )
}
},
rebuild: function() {
- let activityManager = Components.classes["@mozilla.org/activity-manager;1"]
- .getService(Components.interfaces.nsIActivityManager);
+ let activityManager = Cc["@mozilla.org/activity-manager;1"]
+ .getService(Ci.nsIActivityManager);
let activities = activityManager.getActivities({});
for (let activity of activities)
this.addActivityBinding(activity.id, activity);
},
shutdown: function() {
- let activityManager = Components.classes["@mozilla.org/activity-manager;1"]
- .getService(Components.interfaces.nsIActivityManager);
+ let activityManager = Cc["@mozilla.org/activity-manager;1"]
+ .getService(Ci.nsIActivityManager);
activityManager.removeListener(this._activityMgrListener);
},
//////////////////////////////////////////////////////////////////////////////
//// Utility Functions
/**
* Remove all activities not in-progress from the activity list.
*/
clearActivityList: function() {
this._activityLogger.debug("clearActivityList");
this._ignoreNotifications = true;
// If/when we implement search, we'll want to remove just the items
// that are on the search display, however for now, we'll just clear up
// everything.
- Components.classes["@mozilla.org/activity-manager;1"]
- .getService(Components.interfaces.nsIActivityManager)
- .cleanUp();
+ Cc["@mozilla.org/activity-manager;1"]
+ .getService(Ci.nsIActivityManager)
+ .cleanUp();
// since XBL dtors are not working properly when we remove the element,
// we have to explicitly remove the binding from activities' listeners
// list. See bug 230086 for details.
let activities = this._activitiesView.childNodes;
for (let i = activities.length - 1; i >= 0; i--) {
let item = activities[i];
if (!item.isGroup)
--- a/mail/components/activity/content/activity.xml
+++ b/mail/components/activity/content/activity.xml
@@ -63,18 +63,18 @@
return document.getAnonymousElementByAttribute(this, "anonid",
"activityGroupView");
]]>
</getter>
</property>
<method name="retry">
<body>
<![CDATA[
- let activityManager = Components.classes["@mozilla.org/activity-manager;1"]
- .getService(Components.interfaces.nsIActivityManager);
+ let activityManager = Cc["@mozilla.org/activity-manager;1"]
+ .getService(Ci.nsIActivityManager);
let processes = activityManager
.getProcessesByContext(this.contextType,
this.contextObj, {});
for (let process of processes) {
if (process.retryHandler)
process.retryHandler.retry(process);
}
@@ -110,18 +110,18 @@
<stylesheet src="chrome://messenger/skin/activity/activity.css"/>
</resources>
<implementation implements="nsIActivityListener">
<constructor>
<![CDATA[
ChromeUtils.import("resource:///modules/templateUtils.js", this);
try {
ChromeUtils.import("resource:///modules/gloda/log4moz.js");
- let activityManager = Components.classes["@mozilla.org/activity-manager;1"]
- .getService(Components.interfaces.nsIActivityManager);
+ let activityManager = Cc["@mozilla.org/activity-manager;1"]
+ .getService(Ci.nsIActivityManager);
// fetch the activity and set the base attributes
let actID = this.getAttribute('actID');
this._activity = activityManager.getActivity(actID);
this._activity.addListener(this);
this.setAttribute('iconclass', this._activity.iconClass);
this.log = Log4Moz.getConfiguredLogger("activity-base");
@@ -156,33 +156,33 @@
this._activity.removeListener(this);
]]>
</body>
</method>
<property name="isProcess">
<getter>
<![CDATA[
return this._activity && (this._activity instanceof
- Components.interfaces.nsIActivityProcess);
+ Ci.nsIActivityProcess);
]]>
</getter>
</property>
<property name="isEvent">
<getter>
<![CDATA[
return this._activity && (this._activity instanceof
- Components.interfaces.nsIActivityEvent);
+ Ci.nsIActivityEvent);
]]>
</getter>
</property>
<property name="isWarning">
<getter>
<![CDATA[
return this._activity && (this._activity instanceof
- Components.interfaces.nsIActivityWarning);
+ Ci.nsIActivityWarning);
]]>
</getter>
</property>
<property name="isOrphan">
<getter>
<![CDATA[
try {
let activity = activityManager.getActivity(this._activity.id);
@@ -255,23 +255,23 @@
<binding id="activity-process"
extends="chrome://messenger/content/activity.xml#activity-base">
<implementation>
<constructor>
<![CDATA[
// We need to make this casting here in order to access to nsIActivityProcess
// interface of the component from the the binding.
// We deliberately propogate the exceptions to the caller.
- this._activity.QueryInterface(Components.interfaces.nsIActivityProcess);
+ this._activity.QueryInterface(Ci.nsIActivityProcess);
try {
this.displayText = this._activity.displayText;
// make sure that binding reflects the latest state of the process
this.onStateChanged(this._activity.state,
- Components.interfaces.nsIActivityProcess.STATE_NOTSTARTED);
+ Ci.nsIActivityProcess.STATE_NOTSTARTED);
this.onProgressChanged(this._activity,
this._activity.lastStatusText,
this._activity.workUnitComplete,
this._activity.totalWorkUnits);
}
catch(e) {
this.log.error("Exception constructing activity-process: " + e);
throw(e)
@@ -301,25 +301,25 @@
this.setAttribute('statusText', val);
]]>
</setter>
</property>
<property name="inProgress">
<getter>
<![CDATA[
return (this._activity.state ==
- Components.interfaces.nsIActivityProcess.STATE_INPROGRESS);
+ Ci.nsIActivityProcess.STATE_INPROGRESS);
]]>
</getter>
</property>
<property name="isRemovable">
<getter>
<![CDATA[
- return this._activity.state == Components.interfaces.nsIActivityProcess.STATE_COMPLETED ||
- this._activity.state == Components.interfaces.nsIActivityProcess.STATE_CANCELED
+ return this._activity.state == Ci.nsIActivityProcess.STATE_COMPLETED ||
+ this._activity.state == Ci.nsIActivityProcess.STATE_CANCELED
]]>
</getter>
</property>
<property name="canCancel">
<getter>
<![CDATA[
try {
return (this._activity.cancelHandler != null);
@@ -375,44 +375,44 @@
let hideRetryBut = true;
let hidePauseBut = true;
let hideResumeBut = true;
let hideProgressMeter = false;
let displayText = this.displayText;
let statusText = this.statusText;
switch(this._activity.state) {
- case Components.interfaces.nsIActivityProcess.STATE_INPROGRESS:
+ case Ci.nsIActivityProcess.STATE_INPROGRESS:
hideCancelBut = !this.canCancel;
hidePauseBut = !this.canPause;
// status text is empty
statusText = "";
break;
- case Components.interfaces.nsIActivityProcess.STATE_COMPLETED:
+ case Ci.nsIActivityProcess.STATE_COMPLETED:
// all buttons and progress meter are hidden
hideProgressMeter = true;
// status text is empty
statusText = "";
break;
- case Components.interfaces.nsIActivityProcess.STATE_CANCELED:
+ case Ci.nsIActivityProcess.STATE_CANCELED:
// all buttons and progress meter are hidden
hideProgressMeter = true;
statusText = this.text.canceled;
break;
- case Components.interfaces.nsIActivityProcess.STATE_PAUSED:
+ case Ci.nsIActivityProcess.STATE_PAUSED:
hideCancelBut = !this.canCancel;
hideResumeBut = !this.canPause;
statusText = this.text.paused;
break;
- case Components.interfaces.nsIActivityProcess.STATE_WAITINGFORINPUT:
+ case Ci.nsIActivityProcess.STATE_WAITINGFORINPUT:
hideCancelBut = !this.canCancel;
hideProgressMeter = true;
statusText = this.text.waitingforinput;
break;
- case Components.interfaces.nsIActivityProcess.STATE_WAITINGFORRETRY:
+ case Ci.nsIActivityProcess.STATE_WAITINGFORRETRY:
hideCancelBut = !this.canCancel;
hideRetryBut = !this.canRetry;
hideProgressMeter = true;
statusText = this.text.waitingforretry;
break;
}
// Set the button visibility
@@ -466,17 +466,17 @@
<parameter name="aActivity"/>
<body>
<![CDATA[
// update handler buttons' visibilities
let hideCancelBut = !this.canCancel;
let hidePauseBut = !this.canPause;
let hideRetryBut = !this.canRetry;
let hideResumeBut = !this.canPause ||
- this._activity.state == Components.interfaces.nsIActivityProcess.STATE_PAUSED;
+ this._activity.state == Ci.nsIActivityProcess.STATE_PAUSED;
this.setVisibility("button_cancel", !hideCancelBut);
this.setVisibility("button_retry", !hideRetryBut);
if (hidePauseBut) {
this.setVisibility("button_pause", !hidePauseBut);
this.setVisibility("button_resume", !hideResumeBut);
}
else {
@@ -485,33 +485,33 @@
}
]]>
</body>
</method>
<property name="paused">
<getter>
<![CDATA[
return parseInt(this.getAttribute("state")) ==
- Components.interfaces.nsIActivityProcess.STATE_PAUSED;
+ Ci.nsIActivityProcess.STATE_PAUSED;
]]>
</getter>
</property>
<property name="waitingforinput">
<getter>
<![CDATA[
return parseInt(this.getAttribute("state")) ==
- Components.interfaces.nsIActivityProcess.STATE_WAITINGFORINPUT;
+ Ci.nsIActivityProcess.STATE_WAITINGFORINPUT;
]]>
</getter>
</property>
<property name="waitingforretry">
<getter>
<![CDATA[
return parseInt(this.getAttribute("state")) ==
- Components.interfaces.nsIActivityProcess.STATE_WAITINGFORRETRY;
+ Ci.nsIActivityProcess.STATE_WAITINGFORRETRY;
]]>
</getter>
</property>
</implementation>
<content class="activityitem">
<xul:hbox flex="1" class="activityContentBox">
<xul:vbox pack="center" class="processIconBox">
<xul:image anonid="image" xbl:inherits="class=iconclass"/>
@@ -557,17 +557,17 @@
<binding id="activity-event"
extends="chrome://messenger/content/activity.xml#activity-base">
<implementation>
<constructor>
<![CDATA[
// We need to make this casting here in order to access
// to nsIActivityEvent interface of the component from the the binding.
// We deliberately propogate the exceptions to the caller.
- this._activity.QueryInterface(Components.interfaces.nsIActivityEvent);
+ this._activity.QueryInterface(Ci.nsIActivityEvent);
try {
this.displayText = this._activity.displayText;
this.statusText = this._activity.statusText;
this.completionTime = this._activity.completionTime;
this.setVisibility("button_undo", this._activity.undoHandler);
}
catch(e) {
@@ -668,17 +668,17 @@
extends="chrome://messenger/content/activity.xml#activity-base">
<implementation>
<constructor>
<![CDATA[
// We need to make this casting here in order to access to
// nsIActivityWarning interface of the component from the the binding.
// We deliberately propogate the exceptions to the caller.
- this._activity.QueryInterface(Components.interfaces.nsIActivityWarning);
+ this._activity.QueryInterface(Ci.nsIActivityWarning);
try {
this.displayText = this._activity.displayText;
this.dateTime = this._activity.time;
this.recoveryTipText = this._activity.recoveryTipText;
this.setVisibility("button_recover", this._activity.recoveryHandler);
}
catch(e) {
--- a/mail/components/activity/modules/autosync.js
+++ b/mail/components/activity/modules/autosync.js
@@ -12,17 +12,17 @@ var nsActEvent = Components.Constructor(
var nsActWarning = Components.Constructor("@mozilla.org/activity-warning;1",
"nsIActivityWarning", "init");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
ChromeUtils.import("resource:///modules/gloda/log4moz.js");
-var nsIAutoSyncMgrListener = Components.interfaces.nsIAutoSyncMgrListener;
+var nsIAutoSyncMgrListener = Ci.nsIAutoSyncMgrListener;
/**
* This code aims to mediate between the auto-sync code and the activity mgr.
*
* Not every auto-sync activity is directly mapped to a process or event.
* To prevent a possible event overflow, Auto-Sync monitor generates one
* sync'd event per account when after all its _pending_ folders are sync'd,
* rather than generating one event per folder sync.
@@ -144,26 +144,26 @@ var autosyncModule =
} catch (e) {
this.log.error("onStateChanged: " + e);
throw(e);
}
},
onFolderAddedIntoQ : function(queue, folder) {
try {
- if (folder instanceof Components.interfaces.nsIMsgFolder &&
+ if (folder instanceof Ci.nsIMsgFolder &&
queue == nsIAutoSyncMgrListener.PriorityQueue) {
this._inQFolderList.push(folder);
this.log.info("Auto_Sync OnFolderAddedIntoQ [" + this._inQFolderList.length + "] " +
folder.prettyName + " of " + folder.server.prettyName);
// create an activity process for this folder
let process = this.createSyncMailProcess(folder);
// create a sync object to keep track of the process of this folder
- let imapFolder = folder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ let imapFolder = folder.QueryInterface(Ci.nsIMsgImapMailFolder);
let syncItem = { syncFolder: folder,
activity: process,
percentComplete: 0,
totalDownloaded: 0,
pendingMsgCount: imapFolder.autoSyncStateObj.pendingMessageCount
};
// if this is the first folder of this server in the queue, then set the sync start time
@@ -180,32 +180,32 @@ var autosyncModule =
}
} catch (e) {
this.log.error("onFolderAddedIntoQ: " + e);
throw(e);
}
},
onFolderRemovedFromQ : function(queue, folder) {
try {
- if (folder instanceof Components.interfaces.nsIMsgFolder &&
+ if (folder instanceof Ci.nsIMsgFolder &&
queue == nsIAutoSyncMgrListener.PriorityQueue) {
let i = this._inQFolderList.indexOf(folder);
if (i > -1)
this._inQFolderList.splice(i, 1);
this.log.info("OnFolderRemovedFromQ [" + this._inQFolderList.length + "] " +
folder.prettyName + " of " + folder.server.prettyName + "\n");
let syncItem = this._syncInfoPerFolder.get(folder.URI);
let process = syncItem.activity;
let canceled = false;
- if (process instanceof Components.interfaces.nsIActivityProcess)
+ if (process instanceof Ci.nsIActivityProcess)
{
- canceled = (process.state == Components.interfaces.nsIActivityProcess.STATE_CANCELED);
- process.state = Components.interfaces.nsIActivityProcess.STATE_COMPLETED;
+ canceled = (process.state == Ci.nsIActivityProcess.STATE_CANCELED);
+ process.state = Ci.nsIActivityProcess.STATE_COMPLETED;
try {
this.activityMgr.removeActivity(process.id);
}
catch(e) {
// It is OK to end up here; If the folder is queued and the
// message get manually downloaded by the user, we might get
// a folder removed notification even before a donwload
@@ -246,39 +246,39 @@ var autosyncModule =
}
} catch (e) {
this.log.error("onFolderRemovedFromQ: " + e);
throw(e);
}
},
onDownloadStarted : function(folder, numOfMessages, totalPending) {
try {
- if (folder instanceof Components.interfaces.nsIMsgFolder) {
+ if (folder instanceof Ci.nsIMsgFolder) {
this.log.info("OnDownloadStarted (" + numOfMessages + "/" + totalPending + "): " +
folder.prettyName + " of " + folder.server.prettyName + "\n");
let syncItem = this._syncInfoPerFolder.get(folder.URI);
let process = syncItem.activity;
// Update the totalPending number. if new messages have been discovered in the folder
// after we added the folder into the q, totalPending might be greater than what we have
// initially set
if (totalPending > syncItem.pendingMsgCount)
syncItem.pendingMsgCount = totalPending;
- if (process instanceof Components.interfaces.nsIActivityProcess) {
+ if (process instanceof Ci.nsIActivityProcess) {
// if the process has not beed added to activity manager already, add now
if (!this.activityMgr.containsActivity(process.id)) {
this.log.info("Auto_Sync OnDownloadStarted: No process, adding a new process");
this.activityMgr.addActivity(process);
}
syncItem.totalDownloaded += numOfMessages;
- process.state = Components.interfaces.nsIActivityProcess.STATE_INPROGRESS;
+ process.state = Ci.nsIActivityProcess.STATE_INPROGRESS;
let percent = (syncItem.totalDownloaded/syncItem.pendingMsgCount)*100;
if (percent > syncItem.percentComplete)
syncItem.percentComplete = percent;
let msg = this.bundle.formatStringFromName("autosyncProcessProgress2",
[syncItem.totalDownloaded,
syncItem.pendingMsgCount,
folder.prettyName,
@@ -294,35 +294,35 @@ var autosyncModule =
} catch (e) {
this.log.error("onDownloadStarted: " + e);
throw(e);
}
},
onDownloadCompleted : function(folder) {
try {
- if (folder instanceof Components.interfaces.nsIMsgFolder) {
+ if (folder instanceof Ci.nsIMsgFolder) {
this.log.info("OnDownloadCompleted: " + folder.prettyName + " of " +
folder.server.prettyName);
let process = this._syncInfoPerFolder.get(folder.URI).activity;
- if (process instanceof Components.interfaces.nsIActivityProcess &&
+ if (process instanceof Ci.nsIActivityProcess &&
!this._running) {
this.log.info("OnDownloadCompleted: Auto-Sync Manager is paused, pausing the process");
- process.state = Components.interfaces.nsIActivityProcess.STATE_PAUSED;
+ process.state = Ci.nsIActivityProcess.STATE_PAUSED;
}
}
} catch (e) {
this.log.error("onDownloadCompleted: " + e);
throw(e);
}
},
onDownloadError : function(folder) {
- if (folder instanceof Components.interfaces.nsIMsgFolder) {
+ if (folder instanceof Ci.nsIMsgFolder) {
this.log.error("OnDownloadError: " + folder.prettyName + " of " +
folder.server.prettyName + "\n");
}
},
onDiscoveryQProcessed : function (folder, numOfHdrsProcessed, leftToProcess) {
this.log.info("onDiscoveryQProcessed: Processed " + numOfHdrsProcessed + "/" +
(leftToProcess+numOfHdrsProcessed) + " of " + folder.prettyName + "\n");
@@ -331,12 +331,12 @@ var autosyncModule =
onAutoSyncInitiated : function (folder) {
this.log.info("onAutoSyncInitiated: " + folder.prettyName + " of " +
folder.server.prettyName + " has been updated.\n");
},
init: function() {
// XXX when do we need to remove ourselves?
this.log.info('initing');
- Components.classes["@mozilla.org/imap/autosyncmgr;1"]
- .getService(Components.interfaces.nsIAutoSyncManager).addListener(this);
+ Cc["@mozilla.org/imap/autosyncmgr;1"]
+ .getService(Ci.nsIAutoSyncManager).addListener(this);
},
}
--- a/mail/components/activity/modules/moveCopy.js
+++ b/mail/components/activity/modules/moveCopy.js
@@ -59,17 +59,17 @@ var moveCopyModule =
this.log.info("in msgsDeleted");
let count = aMsgList.length;
if (count <= 0)
return;
let displayCount = count;
// get the folder of the deleted messages
- let folder = aMsgList.queryElementAt(0, Components.interfaces.nsIMsgDBHdr).folder;
+ let folder = aMsgList.queryElementAt(0, Ci.nsIMsgDBHdr).folder;
let activities = this.activityMgr.getActivities({})
if (activities.length > 0 &&
activities[activities.length-1].id == this.lastMessage.id &&
this.lastMessage.type == "deleteMail" &&
this.lastMessage.folder == folder.prettyName)
{
displayCount += this.lastMessage.count;
@@ -92,33 +92,33 @@ var moveCopyModule =
Date.now(), // start time
Date.now()); // completion time
event.iconClass = "deleteMail";
this.lastMessage.type = event.iconClass;
for (let i = 0; i < count; i++)
{
- let msgHdr = aMsgList.queryElementAt(i, Components.interfaces.nsIMsgDBHdr);
+ let msgHdr = aMsgList.queryElementAt(i, Ci.nsIMsgDBHdr);
event.addSubject(msgHdr.messageId);
}
this.lastMessage.id = this.activityMgr.addActivity(event);
},
msgsMoveCopyCompleted : function(aMove, aSrcMsgList, aDestFolder) {
try {
this.log.info("in msgsMoveCopyCompleted");
let count = aSrcMsgList.length;
if (count <= 0)
return;
// get the folder of the moved/copied messages
- let folder = aSrcMsgList.queryElementAt(0, Components.interfaces.nsIMsgDBHdr).folder;
+ let folder = aSrcMsgList.queryElementAt(0, Ci.nsIMsgDBHdr).folder;
this.log.info("got folder");
let displayCount = count;
let activities = this.activityMgr.getActivities({});
if (activities.length > 0 &&
activities[activities.length-1].id == this.lastMessage.id &&
this.lastMessage.type == (aMove ? "moveMail" : "copyMail") &&
@@ -163,17 +163,17 @@ var moveCopyModule =
statusText,
Date.now(), // start time
Date.now()); // completion time
event.iconClass = aMove ? "moveMail" : "copyMail";
this.lastMessage.type = event.iconClass;
for (let i = 0; i < count; i++)
{
- let msgHdr = aSrcMsgList.queryElementAt(i, Components.interfaces.nsIMsgDBHdr);
+ let msgHdr = aSrcMsgList.queryElementAt(i, Ci.nsIMsgDBHdr);
event.addSubject(msgHdr.messageId);
}
this.lastMessage.id = this.activityMgr.addActivity(event);
} catch (e) {
this.log.error("Exception: " + e)
}
},
@@ -291,18 +291,18 @@ var moveCopyModule =
event.addSubject(aOrigFolder);
event.addSubject(aNewFolder);
this.activityMgr.addActivity(event);
},
itemEvent: function(aItem, aEvent, aData, aString) {
if (aEvent == "UnincorporatedMessageMoved") {
- let srcFolder = aItem.QueryInterface(Components.interfaces.nsIMsgFolder);
- let msgHdr = aData.QueryInterface(Components.interfaces.nsIMsgDBHdr);
+ let srcFolder = aItem.QueryInterface(Ci.nsIMsgFolder);
+ let msgHdr = aData.QueryInterface(Ci.nsIMsgDBHdr);
try {
this.log.info("in UnincorporatedMessageMoved");
// get the folder of the moved/copied messages
let destFolder = msgHdr.folder;
this.log.info("got folder");
--- a/mail/components/addrbook/content/abCardOverlay.js
+++ b/mail/components/addrbook/content/abCardOverlay.js
@@ -76,20 +76,20 @@ var gHideABPicker = false;
var gPhotoHandlers = {};
function OnLoadNewCard()
{
InitEditCard();
gEditCard.card =
(("arguments" in window) && (window.arguments.length > 0) &&
- (window.arguments[0] instanceof Components.interfaces.nsIAbCard))
+ (window.arguments[0] instanceof Ci.nsIAbCard))
? window.arguments[0]
- : Components.classes["@mozilla.org/addressbook/cardproperty;1"]
- .createInstance(Components.interfaces.nsIAbCard);
+ : Cc["@mozilla.org/addressbook/cardproperty;1"]
+ .createInstance(Ci.nsIAbCard);
gEditCard.titleProperty = "newContactTitle";
gEditCard.selectedAB = "";
if ("arguments" in window && window.arguments[0])
{
gEditCard.selectedAB = kPersonalAddressbookURI;
if ("selectedAB" in window.arguments[0] &&
@@ -182,25 +182,25 @@ function EditCardOKButton()
}
let listDirectoriesCount = directory.addressLists.length;
let foundDirectories = [];
// create a list of mailing lists and the index where the card is at.
for (let i = 0; i < listDirectoriesCount; i++) {
let subdir = directory.addressLists
- .queryElementAt(i, Components.interfaces.nsIAbDirectory);
+ .queryElementAt(i, Ci.nsIAbDirectory);
if (subdir.isMailList) {
// See if any card in this list is the one we edited.
// Must compare card contents using .equals() instead of .indexOf()
// because gEditCard is not really a member of the .addressLists array.
let listCardsCount = subdir.addressLists.length;
for (let index = 0; index < listCardsCount; index++) {
let card = subdir.addressLists
- .queryElementAt(index, Components.interfaces.nsIAbCard);
+ .queryElementAt(index, Ci.nsIAbCard);
if (card.equals(gEditCard.card))
foundDirectories.push({directory:subdir, cardIndex:index});
}
}
}
CheckAndSetCardValues(gEditCard.card, document, false);
@@ -363,17 +363,17 @@ function NotifySaveListeners(directory)
// in which case we need to commit it.
directory.modifyCard(gEditCard.card);
}
function InitPhoneticFields()
{
var showPhoneticFields =
Services.prefs.getComplexValue("mail.addr_book.show_phonetic_fields",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
// show phonetic fields if indicated by the pref
if (showPhoneticFields == "true")
{
for (var i = kPhoneticFields.length; i-- > 0; )
document.getElementById(kPhoneticFields[i]).hidden = false;
}
}
@@ -387,17 +387,17 @@ function InitEditCard()
// Create gEditCard object that contains global variables for the current js
// file.
gEditCard = new Object();
// get specific prefs that gEditCard will need
try {
var displayLastNameFirst =
Services.prefs.getComplexValue("mail.addr_book.displayName.lastnamefirst",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
gEditCard.displayLastNameFirst = (displayLastNameFirst == "true");
gEditCard.generateDisplayName =
Services.prefs.getBoolPref("mail.addr_book.displayName.autoGeneration");
}
catch (ex) {
dump("ex: failed to get pref" + ex + "\n");
}
}
@@ -1001,19 +1001,19 @@ function removePhoto(aName) {
}
/**
* Opens a file picker with image filters to look for a contact photo.
* If the user selects a file and clicks OK then the PhotoURI textbox is set
* with a file URI pointing to that file and updatePhoto is called.
*/
function browsePhoto() {
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ var nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
fp.init(window, gAddressBookBundle.getString("browsePhoto"), nsIFilePicker.modeOpen);
// Add All Files & Image Files filters and select the latter
fp.appendFilters(nsIFilePicker.filterImages);
fp.appendFilters(nsIFilePicker.filterAll);
fp.open(rv => {
if (rv != nsIFilePicker.returnOK) {
@@ -1079,17 +1079,17 @@ var genericPhotoHandler = {
}
var filePhotoHandler = {
onLoad: function(aCard, aDocument) {
var photoURI = aCard.getProperty("PhotoURI", "");
try {
var file = Services.io.newURI(photoURI)
- .QueryInterface(Components.interfaces.nsIFileURL)
+ .QueryInterface(Ci.nsIFileURL)
.file;
} catch (e) {}
if (!file)
return false;
aDocument.getElementById("PhotoFile").file = file;
return true;
--- a/mail/components/addrbook/content/abCardViewOverlay.js
+++ b/mail/components/addrbook/content/abCardViewOverlay.js
@@ -5,17 +5,17 @@
//NOTE: gAddressBookBundle must be defined and set or this Overlay won't work
ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
var gProfileDirURL;
var gFileHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
var gPhotoDisplayHandlers = {};
var zListName;
var zPrimaryEmail;
var zSecondaryEmail;
var zNickname;
var zDisplayName;
var zWork;
@@ -163,19 +163,19 @@ function GetAddressesFromURI(uri)
{
var addresses = "";
var editList = GetDirectoryFromURI(uri);
var addressList = editList.addressLists;
if (addressList) {
var total = addressList.length;
if (total > 0)
- addresses = addressList.queryElementAt(0, Components.interfaces.nsIAbCard).primaryEmail;
+ addresses = addressList.queryElementAt(0, Ci.nsIAbCard).primaryEmail;
for (var i = 1; i < total; i++ ) {
- addresses += ", " + addressList.queryElementAt(i, Components.interfaces.nsIAbCard).primaryEmail;
+ addresses += ", " + addressList.queryElementAt(i, Ci.nsIAbCard).primaryEmail;
}
}
return addresses;
}
function DisplayCardViewPane(realCard)
{
let generatedName = realCard.generateName(
@@ -395,17 +395,17 @@ function DisplayCardViewPane(realCard)
function setBuddyIcon(card, buddyIcon)
{
try {
let myScreenName = Services.prefs.getCharPref("aim.session.screenname");
if (myScreenName && card.primaryEmail) {
if (!gProfileDirURL) {
// lazily create these file urls, and keep them around
- let profileDir = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ let profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
gProfileDirURL = Services.io.newFileURI(profileDir);
}
// if we did have a buddy icon on disk for this screenname, this would be the file url spec for it
var iconURLStr = gProfileDirURL.spec + "/NIM/" + myScreenName + "/picture/" + card.getProperty("_AimScreenName") + ".gif";
// check if the file exists
var file = gFileHandler.getFileFromURLSpec(iconURLStr);
@@ -487,17 +487,17 @@ function cvAddAddressNodes(node, uri)
if (addressList) {
var total = addressList.length;
if (total > 0) {
while (node.hasChildNodes()) {
node.lastChild.remove();
}
for (i = 0; i < total; i++ ) {
var descNode = document.createElement("description");
- var card = addressList.queryElementAt(i, Components.interfaces.nsIAbCard);
+ var card = addressList.queryElementAt(i, Ci.nsIAbCard);
descNode.setAttribute("class", "CardViewLink");
node.appendChild(descNode);
var linkNode = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
linkNode.setAttribute("id", "addr#" + i);
linkNode.setAttribute("href", "mailto:" + card.primaryEmail);
descNode.appendChild(linkNode);
@@ -533,21 +533,21 @@ function HandleLink(node, label, value,
function OpenURLWithHistory(url)
{
try {
PlacesUtils.asyncHistory.updatePlaces({
uri: Services.io.newURI(url),
visits: [{
visitDate: Date.now() * 1000,
- transitionType: Components.interfaces.nsINavHistoryService.TRANSITION_LINK
+ transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
}]
});
- var messenger = Components.classes["@mozilla.org/messenger;1"].createInstance();
- messenger = messenger.QueryInterface(Components.interfaces.nsIMessenger);
+ var messenger = Cc["@mozilla.org/messenger;1"].createInstance();
+ messenger = messenger.QueryInterface(Ci.nsIMessenger);
messenger.launchExternalURL(url);
} catch (ex) {}
}
function openLink(id)
{
OpenURLWithHistory(document.getElementById(id).getAttribute("href"));
--- a/mail/components/addrbook/content/abCommon.js
+++ b/mail/components/addrbook/content/abCommon.js
@@ -458,18 +458,18 @@ function AbDelete()
// Delete cards from "All Address Books" view.
let cards = GetSelectedAbCards();
for (let i = 0; i < cards.length; i++) {
let dirId = cards[i].directoryId
.substring(0, cards[i].directoryId.indexOf("&"));
let directory = MailServices.ab.getDirectoryFromId(dirId);
let cardArray =
- Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
cardArray.appendElement(cards[i]);
if (directory)
directory.deleteCards(cardArray);
}
SetAbView(kAllDirectoryRoot + "?");
} else {
// Delete cards from address books or mailing lists.
gAbView.deleteSelectedCards();
@@ -493,24 +493,24 @@ function AbEditCard(card)
}
else {
goEditCardDialog(getSelectedDirectoryURI(), card);
}
}
function AbNewMessage()
{
- let msgComposeType = Components.interfaces.nsIMsgCompType;
- let msgComposeFormat = Components.interfaces.nsIMsgCompFormat;
+ let msgComposeType = Ci.nsIMsgCompType;
+ let msgComposeFormat = Ci.nsIMsgCompFormat;
- let params = Components.classes["@mozilla.org/messengercompose/composeparams;1"].createInstance(Components.interfaces.nsIMsgComposeParams);
+ let params = Cc["@mozilla.org/messengercompose/composeparams;1"].createInstance(Ci.nsIMsgComposeParams);
if (params) {
params.type = msgComposeType.New;
params.format = msgComposeFormat.Default;
- let composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"].createInstance(Components.interfaces.nsIMsgCompFields);
+ let composeFields = Cc["@mozilla.org/messengercompose/composefields;1"].createInstance(Ci.nsIMsgCompFields);
if (composeFields) {
if (DirPaneHasFocus()) {
let selectedDir = getSelectedDirectory();
let hidesRecipients = false;
try {
// This is a bit of hackery so that extensions can have mailing lists
// where recipients are sent messages via BCC.
hidesRecipients = selectedDir.getBoolValue("HidesRecipients", false);
@@ -562,28 +562,28 @@ function GetSelectedAddressesFromDirTree
if (!selectedDir || !selectedDir.isMailList)
return "";
let listCardsCount = selectedDir.addressLists.length;
let cards = new Array(listCardsCount);
for (let i = 0; i < listCardsCount; ++i)
cards[i] = selectedDir.addressLists
- .queryElementAt(i, Components.interfaces.nsIAbCard);
+ .queryElementAt(i, Ci.nsIAbCard);
return GetAddressesForCards(cards);
}
// Generate a comma separated list of addresses from a given
// set of cards.
function GetAddressesForCards(cards)
{
var addresses = "";
if (!cards) {
- Components.utils.reportError("GetAddressesForCards: |cards| is null.");
+ Cu.reportError("GetAddressesForCards: |cards| is null.");
return addresses;
}
var count = cards.length;
// We do not handle the case where there is one or more null-ish
// element in the Array. Always non-null element is pushed into
// cards[] array.
@@ -893,21 +893,21 @@ function QuickSearchFocus()
}
}
/**
* Returns an nsIFile of the directory in which contact photos are stored.
* This will create the directory if it does not yet exist.
*/
function getPhotosDir() {
- let file = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
// Get the Photos directory
file.append("Photos");
if (!file.exists() || !file.isDirectory())
- file.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, PERMS_DIRECTORY);
+ file.create(Ci.nsIFile.DIRECTORY_TYPE, PERMS_DIRECTORY);
return file;
}
/**
* Returns a URI specifying the location of a photo based on its name.
* If the name is blank, or if the photo with that name is not in the Photos
* directory then the default photo URI is returned.
*
@@ -950,18 +950,18 @@ function storePhoto(aUri)
// Get the photos directory and check that it exists
let file = getPhotosDir();
// Create a channel from the URI and open it as an input stream
let channel = Services.io.newChannelFromURI2(Services.io.newURI(aUri),
null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
let istream = channel.open();
// Get the photo file
file = makePhotoFile(file, findPhotoExt(channel));
return IOUtils.saveStreamToFile(istream, file);
}
@@ -973,21 +973,21 @@ function storePhoto(aUri)
* The original function can be called if the URI does not match.
*
* @param aUri The URI of the photo.
* @param aChannel The opened channel for the URI.
*
* @return The extension of the file, if any, including the period.
*/
function findPhotoExt(aChannel) {
- var mimeSvc = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService);
+ var mimeSvc = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService);
var ext = "";
var uri = aChannel.URI;
- if (uri instanceof Components.interfaces.nsIURL)
+ if (uri instanceof Ci.nsIURL)
ext = uri.fileExtension;
try {
return mimeSvc.getPrimaryExtension(aChannel.contentType, ext);
} catch (e) {}
return ext;
}
/**
--- a/mail/components/addrbook/content/abTrees.js
+++ b/mail/components/addrbook/content/abTrees.js
@@ -217,17 +217,17 @@ directoryTreeView.prototype = {
return i;
}
return -1;
},
// nsIAbListener interfaces
onItemAdded: function dtv_onItemAdded(aParent, aItem) {
- if (!(aItem instanceof Components.interfaces.nsIAbDirectory))
+ if (!(aItem instanceof Ci.nsIAbDirectory))
return;
//xxx we can optimize this later
this._rebuild();
if (!this._tree)
return;
// Now select this new item
@@ -235,17 +235,17 @@ directoryTreeView.prototype = {
if (row.id == aItem.URI) {
this.selection.select(i);
break;
}
}
},
onItemRemoved: function dtv_onItemRemoved(aParent, aItem) {
- if (!(aItem instanceof Components.interfaces.nsIAbDirectory))
+ if (!(aItem instanceof Ci.nsIAbDirectory))
return;
//xxx we can optimize this later
this._rebuild();
if (!this._tree)
return;
// If we're deleting a top-level address-book, just select the first book
@@ -260,17 +260,17 @@ directoryTreeView.prototype = {
if (row.id == aParent.URI) {
this.selection.select(i);
break;
}
}
},
onItemPropertyChanged: function dtv_onItemProp(aItem, aProp, aOld, aNew) {
- if (!(aItem instanceof Components.interfaces.nsIAbDirectory))
+ if (!(aItem instanceof Ci.nsIAbDirectory))
return;
for (var i in this._rowMap) {
if (this._rowMap[i]._directory == aItem) {
this._tree.invalidateRow(i);
break;
}
}
--- a/mail/components/addrbook/content/addressbook.js
+++ b/mail/components/addrbook/content/addressbook.js
@@ -7,29 +7,29 @@
// Ensure the activity modules are loaded for this window.
ChromeUtils.import("resource:///modules/activity/activityModules.js");
ChromeUtils.import("resource:///modules/ABQueryUtils.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
-var nsIAbListener = Components.interfaces.nsIAbListener;
+var nsIAbListener = Ci.nsIAbListener;
var kPrefMailAddrBookLastNameFirst = "mail.addr_book.lastnamefirst";
var kPersistCollapseMapStorage = "directoryTree.json";
var gSearchTimer = null;
var gStatusText = null;
var gQueryURIFormat = null;
var gCardViewBox;
var gCardViewBoxEmail1;
var gPreviousDirTreeIndex = -1;
-var msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
+var msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
+ .createInstance(Ci.nsIMsgWindow);
var chatHandler = {};
ChromeUtils.import("resource:///modules/chatHandler.jsm", chatHandler);
// Constants that correspond to choices
// in Address Book->View -->Show Name as
var kDisplayName = 0;
var kLastNameFirst = 1;
@@ -58,17 +58,17 @@ var gAddressBookAbListener = {
if (gPreviousDirTreeIndex == -1) {
SelectFirstAddressBook();
}
else {
// Don't reselect if we already have a valid selection, this may be
// the case if items are being removed via other methods, e.g. sidebar,
// LDAP preference pane etc.
if (gDirTree.currentIndex == -1) {
- var directory = item.QueryInterface(Components.interfaces.nsIAbDirectory);
+ var directory = item.QueryInterface(Ci.nsIAbDirectory);
// If we are a mail list, move the selection up the list before
// trying to find the parent. This way we'll end up selecting the
// parent address book when we remove a mailing list.
//
// For simple address books we don't need to move up the list, as
// we want to select the next one upon removal.
if (directory.isMailList && gPreviousDirTreeIndex > 0)
@@ -210,19 +210,19 @@ function delayedOnLoadAddressBook()
// initialize the customizeDone method on the customizeable toolbar
var toolbox = document.getElementById("ab-toolbox");
toolbox.customizeDone = function(aEvent) { MailToolboxCustomizeDone(aEvent, "CustomizeABToolbar"); };
var toolbarset = document.getElementById('customToolbars');
toolbox.toolbarset = toolbarset;
// Ensure we don't load xul error pages into the main window
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
.useErrorPages = false;
MailServices.mailSession.AddMsgWindow(msgWindow);
// Focus the searchbox as we think the user will want to do that
// with the highest probability.
// Bug 1143812: This is disabled for now to keep the New Contact command enabled.
// QuickSearchFocus();
@@ -249,17 +249,17 @@ function GetCurrentPrefs()
var menuitem = top.document.getElementById(menuitemID);
if (menuitem)
menuitem.setAttribute('checked', 'true');
// initialize phonetic
var showPhoneticFields =
Services.prefs.getComplexValue("mail.addr_book.show_phonetic_fields",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
// show phonetic fields if indicated by the pref
if (showPhoneticFields == "true")
document.getElementById("cmd_SortBy_PhoneticName")
.setAttribute("hidden", "false");
}
function SetNameColumn(cmd)
@@ -342,18 +342,18 @@ function AbPrintCardInternal(doPrintPrev
{
var selectedItems = GetSelectedAbCards();
var numSelected = selectedItems.length;
if (!numSelected)
return;
let statusFeedback;
- statusFeedback = Components.classes["@mozilla.org/messenger/statusfeedback;1"].createInstance();
- statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback);
+ statusFeedback = Cc["@mozilla.org/messenger/statusfeedback;1"].createInstance();
+ statusFeedback = statusFeedback.QueryInterface(Ci.nsIMsgStatusFeedback);
let selectionArray = [];
for (let i = 0; i < numSelected; i++) {
let card = selectedItems[i];
let printCardUrl = CreatePrintCardUrl(card);
if (printCardUrl) {
selectionArray.push(printCardUrl);
@@ -366,38 +366,38 @@ function AbPrintCardInternal(doPrintPrev
selectionArray.length, selectionArray,
statusFeedback, doPrintPreview, msgType);
return;
}
function AbPrintCard()
{
- AbPrintCardInternal(false, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_AB_CARD);
+ AbPrintCardInternal(false, Ci.nsIMsgPrintEngine.MNAB_PRINT_AB_CARD);
}
function AbPrintPreviewCard()
{
- AbPrintCardInternal(true, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_AB_CARD);
+ AbPrintCardInternal(true, Ci.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_AB_CARD);
}
function CreatePrintCardUrl(card)
{
return "data:application/xml;base64," + card.translateTo("base64xml");
}
function AbPrintAddressBookInternal(doPrintPreview, msgType)
{
let uri = getSelectedDirectoryURI();
if (!uri)
return;
var statusFeedback;
- statusFeedback = Components.classes["@mozilla.org/messenger/statusfeedback;1"].createInstance();
- statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback);
+ statusFeedback = Cc["@mozilla.org/messenger/statusfeedback;1"].createInstance();
+ statusFeedback = statusFeedback.QueryInterface(Ci.nsIMsgStatusFeedback);
/*
turn "moz-abmdbdirectory://abook.mab" into
"addbook://moz-abmdbdirectory/abook.mab?action=print"
*/
var abURIArr = uri.split("://");
var printUrl = "addbook://" + abURIArr[0] + "/" + abURIArr[1] + "?action=print"
@@ -407,22 +407,22 @@ function AbPrintAddressBookInternal(doPr
"chrome,dialog=no,all",
1, [printUrl], statusFeedback, doPrintPreview, msgType);
return;
}
function AbPrintAddressBook()
{
- AbPrintAddressBookInternal(false, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_ADDRBOOK);
+ AbPrintAddressBookInternal(false, Ci.nsIMsgPrintEngine.MNAB_PRINT_ADDRBOOK);
}
function AbPrintPreviewAddressBook()
{
- AbPrintAddressBookInternal(true, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_ADDRBOOK);
+ AbPrintAddressBookInternal(true, Ci.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_ADDRBOOK);
}
/**
* Export the currently selected addressbook.
*/
function AbExportSelection() {
let selectedDirURI = getSelectedDirectoryURI();
if (!selectedDirURI)
@@ -461,20 +461,20 @@ function AbExport(aSelectedDirURI)
try {
let directory = GetDirectoryFromURI(aSelectedDirURI);
MailServices.ab.exportAddressBook(window, directory);
}
catch (ex) {
let message;
switch (ex.result) {
- case Components.results.NS_ERROR_FILE_ACCESS_DENIED:
+ case Cr.NS_ERROR_FILE_ACCESS_DENIED:
message = gAddressBookBundle.getString("failedToExportMessageFileAccessDenied");
break;
- case Components.results.NS_ERROR_FILE_NO_DEVICE_SPACE:
+ case Cr.NS_ERROR_FILE_NO_DEVICE_SPACE:
message = gAddressBookBundle.getString("failedToExportMessageNoDeviceSpace");
break;
default:
message = ex.message;
break;
}
Services.prompt.alert(window,
@@ -505,17 +505,17 @@ function SetStatusText(total)
statusText =
gAddressBookBundle.getFormattedString(
"totalContactStatus",
[getSelectedDirectory().dirName, total]);
gStatusText.setAttribute("label", statusText);
}
catch(ex) {
- Components.utils.reportError("ERROR: failed to set status text: " + ex );
+ Cu.reportError("ERROR: failed to set status text: " + ex );
}
}
function AbResultsPaneKeyPress(event)
{
if (event.keyCode == 13)
AbEditSelectedCard();
}
@@ -704,31 +704,31 @@ function LaunchUrl(url)
catch (ex) {}
}
function AbIMSelected()
{
let cards = GetSelectedAbCards();
if (!cards) {
- Components.utils.reportError("ERROR: AbIMSelected: |cards| is null.");
+ Cu.reportError("ERROR: AbIMSelected: |cards| is null.");
return;
}
if (cards.length != 1) {
- Components.utils.reportError("AbIMSelected should only be called when 1" +
- " card is selected. There are " +
- cards.length + " cards selected.");
+ Cu.reportError("AbIMSelected should only be called when 1" +
+ " card is selected. There are " +
+ cards.length + " cards selected.");
return;
}
let card = cards[0];
if (!card) {
- Components.utils.reportError("AbIMSelected: one card was selected, but its only member was null.");
+ Cu.reportError("AbIMSelected: one card was selected, but its only member was null.");
return;
}
// We want to open a conversation with the first online username that we can
// find. Failing that, we'll take the first offline (but still chat-able)
// username we can find.
//
// First, sort the IM usernames into two groups - online contacts go into
// the "online" group, and offline (but chat-able) contacts go into the
--- a/mail/components/cloudfile/cloudFileAccounts.js
+++ b/mail/components/cloudfile/cloudFileAccounts.js
@@ -36,17 +36,17 @@ var cloudFileAccounts = {
},
_getInitedProviderForType: function(aAccountKey, aType) {
let provider = this.getProviderForType(aType);
if (provider) {
try {
provider.init(aAccountKey);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
provider = null;
}
}
return provider;
},
_createUniqueAccountKey: function() {
// Pick a unique account key (TODO: this is a dumb way to do it, probably)
@@ -122,17 +122,17 @@ var cloudFileAccounts = {
"char": "setCharPref",
};
for (let prefKey in aExtraPrefs) {
let type = aExtraPrefs[prefKey].type;
let value = aExtraPrefs[prefKey].value;
if (!(type in kFuncMap)) {
- Components.utils.reportError("Did not recognize type: " + type);
+ Cu.reportError("Did not recognize type: " + type);
continue;
}
let func = kFuncMap[type];
Services.prefs[func](ACCOUNT_ROOT + aAccountKey + "." + prefKey,
value);
}
},
@@ -196,17 +196,17 @@ var cloudFileAccounts = {
getDisplayName: function(aKeyOrAccount) {
try {
let key = this._ensureKey(aKeyOrAccount);
return Services.prefs.getCharPref(ACCOUNT_ROOT +
key + ".displayName");
} catch(e) {
// If no display name has been set, we return the empty string.
- Components.utils.reportError(e);
+ Cu.reportError(e);
return "";
}
},
setDisplayName: function(aKeyOrAccount, aDisplayName) {
let key = this._ensureKey(aKeyOrAccount);
Services.prefs.setCharPref(ACCOUNT_ROOT + key +
".displayName", aDisplayName);
--- a/mail/components/cloudfile/content/Box/management.js
+++ b/mail/components/cloudfile/content/Box/management.js
@@ -1,15 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
function onLoadProvider(provider) {
- let messenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ let messenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
let fileSpaceUsed = document.getElementById("file-space-used");
fileSpaceUsed.textContent = messenger.formatFileSize(provider.fileSpaceUsed);
let fileSpaceUsedSwatch = document.getElementById("file-space-used-swatch");
fileSpaceUsedSwatch.style.backgroundColor = pv.Colors.category20.values[0];
let remainingFileSpace = document.getElementById("remaining-file-space");
remainingFileSpace.textContent = messenger.formatFileSize(
--- a/mail/components/cloudfile/content/Hightail/management.js
+++ b/mail/components/cloudfile/content/Hightail/management.js
@@ -1,15 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
function onLoadProvider(provider) {
- let messenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ let messenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
let fileSpaceUsed = document.getElementById("file-space-used");
fileSpaceUsed.textContent = messenger.formatFileSize(provider.fileSpaceUsed);
let fileSpaceUsedSwatch = document.getElementById("file-space-used-swatch");
fileSpaceUsedSwatch.style.backgroundColor = pv.Colors.category20.values[0];
let remainingFileSpace = document.getElementById("remaining-file-space");
remainingFileSpace.textContent = messenger.formatFileSize(
--- a/mail/components/cloudfile/content/addAccountDialog.js
+++ b/mail/components/cloudfile/content/addAccountDialog.js
@@ -27,18 +27,18 @@ createAccountObserver.prototype = {
window.close();
}
else {
if (aContext instanceof Ci.nsIMsgCloudFileProvider) {
cloudFileAccounts.removeAccount(aContext.accountKey);
}
else {
// Something went seriously wrong here...
- Components.utils.reportError("Cloud account creation failed, and " +
- "provider instance missing!");
+ Cu.reportError("Cloud account creation failed, and " +
+ "provider instance missing!");
}
addAccountDialog._accept.disabled = false;
addAccountDialog._messages.selectedPanel = addAccountDialog._error;
}
},
}
--- a/mail/components/cloudfile/nsHightail.js
+++ b/mail/components/cloudfile/nsHightail.js
@@ -1182,17 +1182,17 @@ nsHightailFileUploader.prototype = {
},
/**
* Creates and returns a temporary file on the local file system.
*/
getTempFile: function(leafName) {
let tempfile = Services.dirsvc.get("TmpD", Ci.nsIFile);
tempfile.append(leafName)
- tempfile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, parseInt("0666", 8));
+ tempfile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("0666", 8));
// do whatever you need to the created file
return tempfile.clone()
},
/**
* Cleans up any temporary files that this nsHightailFileUploader may have
* created.
*/
--- a/mail/components/compose/content/EdColorPropsOverlay.xul
+++ b/mail/components/compose/content/EdColorPropsOverlay.xul
@@ -9,17 +9,17 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript">
<![CDATA[
function onAccept() {
// If it's a file, convert to a data URL.
if (gBackgroundImage && /^file:/i.test(gBackgroundImage)) {
let nsFile = Services.io.newURI(gBackgroundImage)
- .QueryInterface(Components.interfaces.nsIFileURL).file;
+ .QueryInterface(Ci.nsIFileURL).file;
if (nsFile.exists()) {
let reader = new FileReader();
reader.addEventListener("load", function() {
gBackgroundImage = reader.result;
gDialog.BackgroundImageInput.value = reader.result;
if (onAccept()) {
window.close();
}
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -24,25 +24,25 @@ ChromeUtils.import("resource://gre/modul
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
ChromeUtils.defineModuleGetter(this, "ShortcutUtils",
"resource://gre/modules/ShortcutUtils.jsm");
/**
* interfaces
*/
-var nsIMsgCompDeliverMode = Components.interfaces.nsIMsgCompDeliverMode;
-var nsIMsgCompSendFormat = Components.interfaces.nsIMsgCompSendFormat;
-var nsIMsgCompConvertible = Components.interfaces.nsIMsgCompConvertible;
-var nsIMsgCompType = Components.interfaces.nsIMsgCompType;
-var nsIMsgCompFormat = Components.interfaces.nsIMsgCompFormat;
-var nsIAbPreferMailFormat = Components.interfaces.nsIAbPreferMailFormat;
-var nsIPlaintextEditorMail = Components.interfaces.nsIPlaintextEditor;
-var nsISupportsString = Components.interfaces.nsISupportsString;
-var mozISpellCheckingEngine = Components.interfaces.mozISpellCheckingEngine;
+var nsIMsgCompDeliverMode = Ci.nsIMsgCompDeliverMode;
+var nsIMsgCompSendFormat = Ci.nsIMsgCompSendFormat;
+var nsIMsgCompConvertible = Ci.nsIMsgCompConvertible;
+var nsIMsgCompType = Ci.nsIMsgCompType;
+var nsIMsgCompFormat = Ci.nsIMsgCompFormat;
+var nsIAbPreferMailFormat = Ci.nsIAbPreferMailFormat;
+var nsIPlaintextEditorMail = Ci.nsIPlaintextEditor;
+var nsISupportsString = Ci.nsISupportsString;
+var mozISpellCheckingEngine = Ci.mozISpellCheckingEngine;
var sDictCount = 0;
/**
* Global message window object. This is used by mail-offline.js and therefore
* should not be renamed. We need to avoid doing this kind of cross file global
* stuff in the future and instead pass this object as parameter when needed by
* functions in the other js file.
@@ -112,45 +112,45 @@ var gAutoSaveKickedIn;
var gEditingDraft;
var gAttachmentsSize;
var gNumUploadingAttachments;
var kComposeAttachDirPrefName = "mail.compose.attach.dir";
function InitializeGlobalVariables()
{
- gMessenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ gMessenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
gMsgCompose = null;
gOriginalMsgURI = null;
gWindowLocked = false;
gContentChanged = false;
gSubjectChanged = false;
gCurrentIdentity = null;
defaultSaveOperation = "draft";
gSendOperationInProgress = false;
gSaveOperationInProgress = false;
gAutoSaving = false;
gCloseWindowAfterSave = false;
gSavedSendNowKey = null;
gSendFormat = nsIMsgCompSendFormat.AskUser;
- gCharsetConvertManager = Components.classes['@mozilla.org/charset-converter-manager;1'].getService(Components.interfaces.nsICharsetConverterManager);
+ gCharsetConvertManager = Cc['@mozilla.org/charset-converter-manager;1'].getService(Ci.nsICharsetConverterManager);
gManualAttachmentReminder = false;
gDisableAttachmentReminder = false;
gLanguageObserver = null;
gLastWindowToHaveFocus = null;
gReceiptOptionChanged = false;
gDSNOptionChanged = false;
gAttachVCardOptionChanged = false;
gAttachmentsSize = 0;
gNumUploadingAttachments = 0;
- msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
+ msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
+ .createInstance(Ci.nsIMsgWindow);
MailServices.mailSession.AddMsgWindow(msgWindow);
}
InitializeGlobalVariables();
function ReleaseGlobalVariables()
{
gCurrentIdentity = null;
gCharsetConvertManager = null;
@@ -339,44 +339,44 @@ var stateListener = {
ComposeFieldsReady();
updateSendCommands(true);
},
NotifyComposeBodyReady: function() {
// Look all the possible compose types (nsIMsgComposeParams.idl):
switch (gComposeType) {
- case Components.interfaces.nsIMsgCompType.MailToUrl:
+ case Ci.nsIMsgCompType.MailToUrl:
gBodyFromArgs = true;
- case Components.interfaces.nsIMsgCompType.New:
- case Components.interfaces.nsIMsgCompType.NewsPost:
- case Components.interfaces.nsIMsgCompType.ForwardAsAttachment:
+ case Ci.nsIMsgCompType.New:
+ case Ci.nsIMsgCompType.NewsPost:
+ case Ci.nsIMsgCompType.ForwardAsAttachment:
this.NotifyComposeBodyReadyNew();
break;
- case Components.interfaces.nsIMsgCompType.Reply:
- case Components.interfaces.nsIMsgCompType.ReplyAll:
- case Components.interfaces.nsIMsgCompType.ReplyToSender:
- case Components.interfaces.nsIMsgCompType.ReplyToGroup:
- case Components.interfaces.nsIMsgCompType.ReplyToSenderAndGroup:
- case Components.interfaces.nsIMsgCompType.ReplyWithTemplate:
- case Components.interfaces.nsIMsgCompType.ReplyToList:
+ case Ci.nsIMsgCompType.Reply:
+ case Ci.nsIMsgCompType.ReplyAll:
+ case Ci.nsIMsgCompType.ReplyToSender:
+ case Ci.nsIMsgCompType.ReplyToGroup:
+ case Ci.nsIMsgCompType.ReplyToSenderAndGroup:
+ case Ci.nsIMsgCompType.ReplyWithTemplate:
+ case Ci.nsIMsgCompType.ReplyToList:
this.NotifyComposeBodyReadyReply();
break;
- case Components.interfaces.nsIMsgCompType.ForwardInline:
+ case Ci.nsIMsgCompType.ForwardInline:
this.NotifyComposeBodyReadyForwardInline();
break;
- case Components.interfaces.nsIMsgCompType.EditTemplate:
+ case Ci.nsIMsgCompType.EditTemplate:
defaultSaveOperation = "template";
- case Components.interfaces.nsIMsgCompType.Draft:
- case Components.interfaces.nsIMsgCompType.Template:
- case Components.interfaces.nsIMsgCompType.Redirect:
- case Components.interfaces.nsIMsgCompType.EditAsNew:
+ case Ci.nsIMsgCompType.Draft:
+ case Ci.nsIMsgCompType.Template:
+ case Ci.nsIMsgCompType.Redirect:
+ case Ci.nsIMsgCompType.EditAsNew:
break;
default:
dump("Unexpected nsIMsgCompType in NotifyComposeBodyReady (" +
gComposeType + ")\n");
}
// Setting the selected item in the identity list will cause an
@@ -517,26 +517,26 @@ var stateListener = {
editor.beginningOfDocument();
editor.enableUndo(true);
editor.resetModificationCount();
},
ComposeProcessDone: function(aResult) {
ToggleWindowLock(false);
- if (aResult== Components.results.NS_OK)
+ if (aResult== Cr.NS_OK)
{
if (!gAutoSaving)
SetContentAndBodyAsUnmodified();
if (gCloseWindowAfterSave)
{
// Notify the SendListener that Send has been aborted and Stopped
if (gMsgCompose)
- gMsgCompose.onSendNotPerformed(null, Components.results.NS_ERROR_ABORT);
+ gMsgCompose.onSendNotPerformed(null, Cr.NS_ERROR_ABORT);
MsgComposeCloseWindow();
}
}
// else if we failed to save, and we're autosaving, need to re-mark the editor
// as changed, so that we won't lose the changes.
else if (gAutoSaving)
{
@@ -564,23 +564,23 @@ var gSendListener = {
onGetDraftFolderURI: function (aFolderURI) {},
onSendNotPerformed: function (aMsgID, aStatus) {},
};
// all progress notifications are done through the nsIWebProgressListener implementation...
var progressListener = {
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus)
{
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_START)
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_START)
{
document.getElementById('compose-progressmeter').setAttribute( "mode", "undetermined" );
document.getElementById("statusbar-progresspanel").collapsed = false;
}
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP)
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
{
gSendOperationInProgress = false;
gSaveOperationInProgress = false;
document.getElementById('compose-progressmeter').setAttribute( "mode", "normal" );
document.getElementById('compose-progressmeter').setAttribute( "value", 0 );
document.getElementById("statusbar-progresspanel").collapsed = true;
document.getElementById('statusText').setAttribute('label', '');
}
@@ -626,22 +626,22 @@ var progressListener = {
onSecurityChange: function(aWebProgress, aRequest, state)
{
// we can ignore this notification
},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIWebProgressListener) ||
- iid.equals(Components.interfaces.nsISupportsWeakReference) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIWebProgressListener) ||
+ iid.equals(Ci.nsISupportsWeakReference) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
};
var defaultController = {
commands: {
cmd_attachFile: {
isEnabled: function() {
return !gWindowLocked;
@@ -1154,17 +1154,17 @@ var attachmentBucketController = {
// files.
// For some reason, the hidden property isn't propagating from the cmd
// to the menuitem.
cmd.hidden = true;
return false;
},
doCommand: function() {
let fileHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
let bucket = document.getElementById("attachmentBucket");
for (let item of bucket.selectedItems) {
if (item && item.uploading) {
let file = fileHandler.getFileFromURLSpec(item.attachment.url);
item.cloudProvider.cancelFileUpload(file);
}
}
@@ -1197,22 +1197,22 @@ var attachmentBucketController = {
/**
* Start composing a new message.
*/
function goOpenNewMessage(aEvent)
{
// If aEvent is passed, check if Shift key was pressed for composition in
// non-default format (HTML vs. plaintext).
let msgCompFormat = (aEvent && aEvent.shiftKey) ?
- Components.interfaces.nsIMsgCompFormat.OppositeOfDefault :
- Components.interfaces.nsIMsgCompFormat.Default;
+ Ci.nsIMsgCompFormat.OppositeOfDefault :
+ Ci.nsIMsgCompFormat.Default;
let identity = getCurrentIdentity();
MailServices.compose.OpenComposeWindow(null, null, null,
- Components.interfaces.nsIMsgCompType.New,
+ Ci.nsIMsgCompType.New,
msgCompFormat, identity, null);
}
function QuoteSelectedMessage()
{
var selectedURIs = GetSelectedMessages();
if (selectedURIs)
for (let i = 0; i < selectedURIs.length; i++)
@@ -1647,18 +1647,18 @@ uploadListener.prototype = {
attachmentItem.dispatchEvent(event);
}
}
gNumUploadingAttachments--;
updateSendCommands(true);
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIRequestObserver,
- Components.interfaces.nsISupportsWeakReference])
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIRequestObserver,
+ Ci.nsISupportsWeakReference])
};
function deletionListener(aAttachment, aCloudProvider)
{
this.attachment = aAttachment;
this.cloudProvider = aCloudProvider;
}
@@ -1673,31 +1673,31 @@ deletionListener.prototype = {
Services.prompt.alert(window,
getComposeBundle().getString("errorCloudFileDeletion.title"),
getComposeBundle().getFormattedString("errorCloudFileDeletion.message",
[displayName,
this.attachment.name]));
}
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIRequestObserver,
- Components.interfaces.nsISupportsWeakReference])
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIRequestObserver,
+ Ci.nsISupportsWeakReference])
};
/**
* Prompt the user for a list of files to attach via a cloud provider.
*
* @param aProvider the cloud provider to upload the files to
*/
function attachToCloud(aProvider)
{
// We need to let the user pick local file(s) to upload to the cloud and
// gather url(s) to those files.
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
fp.init(window, getComposeBundle().getFormattedString(
"chooseFileToAttachViaCloud",
[cloudFileAccounts.getDisplayName(aProvider)]),
nsIFilePicker.modeOpenMultiple);
var lastDirectory = GetLastAttachDirectory();
if (lastDirectory)
fp.displayDirectory = lastDirectory;
@@ -1706,17 +1706,17 @@ function attachToCloud(aProvider)
fp.appendFilters(nsIFilePicker.filterAll);
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.files) {
return;
}
let files = Array.from(fixIterator(fp.files,
- Components.interfaces.nsIFile))
+ Ci.nsIFile))
let attachments = files.map(f => FileToAttachment(f));
let i = 0;
let items = AddAttachments(attachments, function(aItem) {
let listener = new uploadListener(attachments[i], files[i], aProvider);
try {
aProvider.uploadFile(files[i], listener);
}
@@ -1741,19 +1741,19 @@ function attachToCloud(aProvider)
function convertListItemsToCloudAttachment(aItems, aProvider)
{
// If we want to display an offline error message, we should do it here.
// No sense in doing the delete and upload and having them fail.
if (Services.io.offline)
return;
let fileHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
- let convertedAttachments = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
+ let convertedAttachments = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
for (let item of aItems) {
let url = item.attachment.url;
if (item.attachment.sendViaCloud) {
if (item.cloudProvider && item.cloudProvider == aProvider)
continue;
url = item.originalUrl;
@@ -1818,33 +1818,33 @@ function convertToCloudAttachment(aAttac
* Convert an array of attachments to regular (non-cloud) attachments.
*
* @param aItems an array of <attachmentitem>s containing the attachments in
* question
*/
function convertListItemsToRegularAttachment(aItems)
{
let fileHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
- let convertedAttachments = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
+ let convertedAttachments = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
for (let item of aItems) {
if (!item.attachment.sendViaCloud || !item.cloudProvider)
continue;
let file = fileHandler.getFileFromURLSpec(item.originalUrl);
try {
// This will fail for drafts, but we can still send the message
// with a normal attachment.
item.cloudProvider.deleteFile(
file, new deletionListener(item.attachment, item.cloudProvider));
}
catch (ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
item.attachment.url = item.originalUrl;
item.setAttribute("tooltiptext", item.attachment.url);
item.attachment.sendViaCloud = false;
delete item.cloudProvider;
delete item.originalUrl;
@@ -1906,17 +1906,17 @@ var messageComposeOfflineQuitObserver =
// sanity checks
if (aTopic == "network:offline-status-changed")
{
MessageComposeOfflineStateChanged(Services.io.offline);
}
// check whether to veto the quit request (unless another observer already
// did)
else if (aTopic == "quit-application-requested"
- && (aSubject instanceof Components.interfaces.nsISupportsPRBool)
+ && (aSubject instanceof Ci.nsISupportsPRBool)
&& !aSubject.data)
aSubject.data = !ComposeCanClose();
}
}
function AddMessageComposeOfflineQuitObserver()
{
Services.obs.addObserver(messageComposeOfflineQuitObserver,
@@ -1968,17 +1968,17 @@ function MessageComposeOfflineStateChang
}
function DoCommandClose()
{
if (ComposeCanClose()) {
// Notify the SendListener that Send has been aborted and Stopped
if (gMsgCompose)
- gMsgCompose.onSendNotPerformed(null, Components.results.NS_ERROR_ABORT);
+ gMsgCompose.onSendNotPerformed(null, Cr.NS_ERROR_ABORT);
// This destroys the window for us.
MsgComposeCloseWindow();
}
return false;
}
@@ -1989,17 +1989,17 @@ function DoCommandPrint()
PrintUtils.printWindow(editor.outerWindowID, editor);
} catch(ex) {dump("#PRINT ERROR: " + ex + "\n");}
}
function DoCommandPrintPreview()
{
try {
PrintUtils.printPreview(PrintPreviewListener);
- } catch(ex) { Components.utils.reportError(ex); }
+ } catch(ex) { Cu.reportError(ex); }
}
/**
* Locks/Unlocks the window widgets while a message is being saved/sent.
* Locking means to disable all possible items in the window so that
* the user can't click/activate anything.
*
* @param aDisable true = lock the window. false = unlock the window.
@@ -2306,17 +2306,17 @@ function attachmentNotificationSupressed
var attachmentWorker = new Worker("resource:///modules/attachmentChecker.js");
// The array of currently found keywords. Or null if keyword detection wasn't
// run yet so we don't know.
attachmentWorker.lastMessage = null;
attachmentWorker.onerror = function(error)
{
- Components.utils.reportError("Attachment Notification Worker error!!! " + error.message);
+ Cu.reportError("Attachment Notification Worker error!!! " + error.message);
throw error;
};
/**
* Called when attachmentWorker finishes checking of the message for keywords.
*
* @param event If defined, event.data contains an array of found keywords.
* @param aManage If set to true and we determine keywords have changed,
@@ -2360,18 +2360,18 @@ function AttachmentsChanged() {
* This case can happen two scenarios:
* 1) The dictionary that was selected in the preference is removed.
* 2) The selected dictionay changes the way it announces itself to the system,
* so for example "it_IT" changes to "it-IT" and the previously stored
* preference value doesn't apply any more.
*/
function getValidSpellcheckerDictionary(draftLanguage) {
let prefValue = Services.prefs.getCharPref("spellchecker.dictionary");
- let spellChecker = Components.classes["@mozilla.org/spellchecker/engine;1"]
- .getService(mozISpellCheckingEngine);
+ let spellChecker = Cc["@mozilla.org/spellchecker/engine;1"]
+ .getService(mozISpellCheckingEngine);
let o1 = {};
let o2 = {};
spellChecker.getDictionaryList(o1, o2);
let dictList = o1.value;
let count = o2.value;
if (count == 0) {
// If there are no dictionaries, we can't check the value, so return it.
@@ -2395,18 +2395,18 @@ function getValidSpellcheckerDictionary(
var dictionaryRemovalObserver =
{
observe: function(aSubject, aTopic, aData) {
if (aTopic != "spellcheck-dictionary-remove") {
return;
}
let language = document.documentElement.getAttribute("lang");
- let spellChecker = Components.classes["@mozilla.org/spellchecker/engine;1"]
- .getService(mozISpellCheckingEngine);
+ let spellChecker = Cc["@mozilla.org/spellchecker/engine;1"]
+ .getService(mozISpellCheckingEngine);
let o1 = {};
let o2 = {};
spellChecker.getDictionaryList(o1, o2);
let dictList = o1.value;
let count = o2.value;
if (count > 0 && dictList.includes(language)) {
// There still is a dictionary for the language of the document.
@@ -2454,46 +2454,46 @@ function onPasteOrDrop(e) {
if (!gMsgCompose.composeHTML) {
// We're in the plain text editor. Nothing to do here.
return;
}
let html = dataTransfer.getData("text/html");
let doc = (new DOMParser()).parseFromString(html, "text/html");
- let tmpD = Services.dirsvc.get("TmpD", Components.interfaces.nsIFile);
+ let tmpD = Services.dirsvc.get("TmpD", Ci.nsIFile);
let pendingConversions = 0;
let needToPreventDefault = true;
for (let img of doc.images) {
if (!/^file:/i.test(img.src)) {
// Doesn't start with file:. Nothing to do here.
continue;
}
// This may throw if the URL is invalid for the OS.
let nsFile;
try {
nsFile = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler)
+ .QueryInterface(Ci.nsIFileProtocolHandler)
.getFileFromURLSpec(img.src);
} catch (ex) {
continue;
}
if (!nsFile.exists()) {
continue;
}
if (!tmpD.contains(nsFile)) {
// Not anywhere under the temp dir.
continue;
}
- let contentType = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService)
+ let contentType = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService)
.getTypeFromFile(nsFile);
if (!contentType.startsWith("image/")) {
continue;
}
// If we ever get here, we need to prevent the default paste or drop since
// the code below will do its own insertion.
if (needToPreventDefault) {
@@ -2506,18 +2506,18 @@ function onPasteOrDrop(e) {
// Not put in temp in the last minute. May be something other than
// a copy-paste. Let's not allow that.
return;
}
let doTheInsert = function() {
// Now run it through sanitation to make sure there wasn't any
// unwanted things in the content.
- let ParserUtils = Components.classes["@mozilla.org/parserutils;1"]
- .getService(Components.interfaces.nsIParserUtils);
+ let ParserUtils = Cc["@mozilla.org/parserutils;1"]
+ .getService(Ci.nsIParserUtils);
let html2 = ParserUtils.sanitize(doc.documentElement.innerHTML,
ParserUtils.SanitizerAllowStyle);
getBrowser().contentDocument.execCommand("insertHTML", false, html2);
}
// Everything checks out. Convert file to data URL.
let reader = new FileReader();
reader.addEventListener("load", function() {
@@ -2564,17 +2564,17 @@ function ComposeStartup(aParams)
var params = null; // New way to pass parameters to the compose window as a nsIMsgComposeParameters object
var args = null; // old way, parameters are passed as a string
gBodyFromArgs = false;
if (aParams)
params = aParams;
else if (window.arguments && window.arguments[0]) {
try {
- if (window.arguments[0] instanceof Components.interfaces.nsIMsgComposeParams)
+ if (window.arguments[0] instanceof Ci.nsIMsgComposeParams)
params = window.arguments[0];
else
params = handleMailtoArgs(window.arguments[0]);
}
catch(ex) { dump("ERROR with parameters: " + ex + "\n"); }
// if still no dice, try and see if the params is an old fashioned list of string attributes
// XXX can we get rid of this yet?
@@ -2631,36 +2631,36 @@ function ComposeStartup(aParams)
document.addEventListener("drop", onPasteOrDrop);
if (identityList)
FillIdentityList(identityList);
if (!params) {
// This code will go away soon as now arguments are passed to the window using a object of type nsMsgComposeParams instead of a string
- params = Components.classes["@mozilla.org/messengercompose/composeparams;1"].createInstance(Components.interfaces.nsIMsgComposeParams);
- params.composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"].createInstance(Components.interfaces.nsIMsgCompFields);
+ params = Cc["@mozilla.org/messengercompose/composeparams;1"].createInstance(Ci.nsIMsgComposeParams);
+ params.composeFields = Cc["@mozilla.org/messengercompose/composefields;1"].createInstance(Ci.nsIMsgCompFields);
if (args) { //Convert old fashion arguments into params
var composeFields = params.composeFields;
if (args.bodyislink == "true")
params.bodyIsLink = true;
if (args.type)
params.type = args.type;
if (args.format)
{
// Only use valid values.
- if (args.format == Components.interfaces.nsIMsgCompFormat.PlainText ||
- args.format == Components.interfaces.nsIMsgCompFormat.HTML ||
- args.format == Components.interfaces.nsIMsgCompFormat.OppositeOfDefault)
+ if (args.format == Ci.nsIMsgCompFormat.PlainText ||
+ args.format == Ci.nsIMsgCompFormat.HTML ||
+ args.format == Ci.nsIMsgCompFormat.OppositeOfDefault)
params.format = args.format;
else if (args.format.toLowerCase().trim() == "html")
- params.format = Components.interfaces.nsIMsgCompFormat.HTML;
+ params.format = Ci.nsIMsgCompFormat.HTML;
else if (args.format.toLowerCase().trim() == "text")
- params.format = Components.interfaces.nsIMsgCompFormat.PlainText;
+ params.format = Ci.nsIMsgCompFormat.PlainText;
}
if (args.originalMsgURI)
params.originalMsgURI = args.originalMsgURI;
if (args.preselectid)
params.identity = getIdentityForKey(args.preselectid);
if (args.from)
composeFields.from = args.from;
if (args.to)
@@ -2671,27 +2671,27 @@ function ComposeStartup(aParams)
composeFields.bcc = args.bcc;
if (args.newsgroups)
composeFields.newsgroups = args.newsgroups;
if (args.subject)
composeFields.subject = args.subject;
if (args.attachment)
{
let attachmentList = args.attachment.split(",");
- let commandLine = Components.classes["@mozilla.org/toolkit/command-line;1"]
- .createInstance();
+ let commandLine = Cc["@mozilla.org/toolkit/command-line;1"]
+ .createInstance();
for (let attachmentName of attachmentList)
{
// resolveURI does all the magic around working out what the
// attachment is, including web pages, and generating the correct uri.
let uri = commandLine.resolveURI(attachmentName);
- let attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"]
- .createInstance(Components.interfaces.nsIMsgAttachment);
+ let attachment = Cc["@mozilla.org/messengercompose/attachment;1"]
+ .createInstance(Ci.nsIMsgAttachment);
// If uri is for a file and it exists set the attachment size.
- if (uri instanceof Components.interfaces.nsIFileURL)
+ if (uri instanceof Ci.nsIFileURL)
{
if (uri.file.exists())
attachment.size = uri.file.fileSize;
else
attachment = null;
}
// Only want to attach if a file that exists or it is not a file.
@@ -2707,40 +2707,40 @@ function ComposeStartup(aParams)
[attachmentName]);
Services.prompt.alert(null, title, msg);
}
}
}
if (args.newshost)
composeFields.newshost = args.newshost;
if (args.message) {
- let msgFile = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ let msgFile = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
if (OS.Path.dirname(args.message) == ".") {
- let workingDir = Services.dirsvc.get("CurWorkD", Components.interfaces.nsIFile);
+ let workingDir = Services.dirsvc.get("CurWorkD", Ci.nsIFile);
args.message = OS.Path.join(workingDir.path, OS.Path.basename(args.message));
}
msgFile.initWithPath(args.message);
if (!msgFile.exists()) {
let title = getComposeBundle().getString("errorFileMessageTitle");
let msg = getComposeBundle().getFormattedString("errorFileMessageMessage",
[args.message]);
Services.prompt.alert(null, title, msg);
}
else {
let data = "";
let fstream = null;
let cstream = null;
try {
- fstream = Components.classes["@mozilla.org/network/file-input-stream;1"]
- .createInstance(Components.interfaces.nsIFileInputStream);
- cstream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
- .createInstance(Components.interfaces.nsIConverterInputStream);
+ fstream = Cc["@mozilla.org/network/file-input-stream;1"]
+ .createInstance(Ci.nsIFileInputStream);
+ cstream = Cc["@mozilla.org/intl/converter-input-stream;1"]
+ .createInstance(Ci.nsIConverterInputStream);
fstream.init(msgFile, -1, 0, 0); // Open file in default/read-only mode.
cstream.init(fstream, "UTF-8", 0, 0);
let str = {};
let read = 0;
do {
// Read as much as we can and put it in str.value.
@@ -2758,17 +2758,17 @@ function ComposeStartup(aParams)
cstream.close();
if (fstream)
fstream.close();
}
if (data) {
let pos = data.search(/\S/); // Find first non-whitespace character.
- if (params.format != Components.interfaces.nsIMsgCompFormat.PlainText &&
+ if (params.format != Ci.nsIMsgCompFormat.PlainText &&
(args.message.endsWith(".htm") || args.message.endsWith(".html") ||
data.substr(pos, 14).toLowerCase() == "<!doctype html" ||
data.substr(pos, 5).toLowerCase() == "<html")) {
// We replace line breaks because otherwise they'll be converted to
// <br> in nsMsgCompose::BuildBodyMessageAndSignature().
// Don't do the conversion if the user asked explicitly for plain text.
data = data.replace(/\r?\n/g," ");
}
@@ -2804,34 +2804,34 @@ function ComposeStartup(aParams)
from[0].email.toLowerCase().trim() : null;
if (!params.identity || !params.identity.email ||
(from && !emailSimilar(from, params.identity.email))) {
let identities = MailServices.accounts.allIdentities;
let suitableCount = 0;
// Search for a matching identity.
if (from) {
- for (let ident of fixIterator(identities, Components.interfaces.nsIMsgIdentity)) {
+ for (let ident of fixIterator(identities, Ci.nsIMsgIdentity)) {
if (from == ident.email.toLowerCase()) {
if (suitableCount == 0)
params.identity = ident;
suitableCount++;
if (suitableCount > 1)
break; // No need to find more, it's already not unique.
}
}
}
if (!params.identity || !params.identity.email) {
// No preset identity and no match, so use the default account.
let identity = MailServices.accounts.defaultAccount.defaultIdentity;
if (!identity) {
let identities = MailServices.accounts.allIdentities;
if (identities.length > 0)
- identity = identities.queryElementAt(0, Components.interfaces.nsIMsgIdentity);
+ identity = identities.queryElementAt(0, Ci.nsIMsgIdentity);
}
params.identity = identity;
}
// Warn if no or more than one match was found.
// But don't warn for +suffix additions (a+b@c.com).
if (from && (suitableCount > 1 ||
(suitableCount == 0 && !emailSimilar(from, params.identity.email))))
@@ -2943,17 +2943,17 @@ function ComposeStartup(aParams)
// which creates the editor.
try {
GetCurrentCommandManager().
addCommandObserver(gMsgEditorCreationObserver, "obs_documentCreated");
// Load empty page to create the editor.
editorElement.webNavigation.loadURI("about:blank", 0, null, null, null);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
gEditingDraft = gMsgCompose.compFields.draftId;
// finally, see if we need to auto open the address sidebar.
var sideBarBox = document.getElementById('sidebar-box');
if (sideBarBox.getAttribute("sidebarVisible") == "true")
{
@@ -2989,17 +2989,17 @@ var gMsgEditorCreationObserver =
{
observe: function(aSubject, aTopic, aData)
{
if (aTopic == "obs_documentCreated")
{
var editor = GetCurrentEditor();
if (editor && GetCurrentCommandManager() == aSubject)
{
- var editorStyle = editor.QueryInterface(Components.interfaces.nsIEditorStyleSheets);
+ var editorStyle = editor.QueryInterface(Ci.nsIEditorStyleSheets);
// We use addOverrideStyleSheet rather than addStyleSheet so that we get
// a synchronous load, rather than having a late-finishing async load
// mark our editor as modified when the user hasn't typed anything yet,
// but that means the sheet must not @import slow things, especially
// not over the network.
editorStyle.addOverrideStyleSheet("chrome://messenger/skin/messageQuotes.css");
InitEditor();
}
@@ -3050,17 +3050,17 @@ function ComposeLoad()
var other_headers_Array = other_headers.split(",");
for (let i = 0; i < other_headers_Array.length; i++)
selectNode.appendItem(other_headers_Array[i] + ":", "addr_other");
}
if (state)
ComposeStartup(null);
}
catch (ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
Services.prompt.alert(window, getComposeBundle().getString("initErrorDlogTitle"),
getComposeBundle().getString("initErrorDlgMessage"));
MsgComposeCloseWindow();
return;
}
ToolbarIconColor.init();
@@ -3139,17 +3139,17 @@ function GetCharsetUIString()
if (!charset)
return "";
if (charset.toLowerCase() != gMsgCompose.compFields.defaultCharacterSet.toLowerCase()) {
try {
return gCharsetConvertManager.getCharsetTitle(charset);
}
catch(e) { // Not a canonical charset after all...
- Components.utils.reportError("No charset title for charset=" + charset);
+ Cu.reportError("No charset title for charset=" + charset);
return charset;
}
}
return "";
}
// Add-ons can override this to customize the behavior.
function DoSpellCheckBeforeSend()
@@ -3377,34 +3377,34 @@ function GenericSendMessage(msgType)
// compose-send-message event for listeners such as smime so they can do
// any pre-security work such as fetching certificates before sending.
var event = document.createEvent("UIEvents");
event.initEvent("compose-send-message", false, true);
var msgcomposeWindow = document.getElementById("msgcomposeWindow");
msgcomposeWindow.setAttribute("msgtype", msgType);
msgcomposeWindow.dispatchEvent(event);
if (event.defaultPrevented)
- throw Components.results.NS_ERROR_ABORT;
+ throw Cr.NS_ERROR_ABORT;
gAutoSaving = (msgType == nsIMsgCompDeliverMode.AutoSaveAsDraft);
// disable the ui if we're not auto-saving
if (!gAutoSaving)
ToggleWindowLock(true);
// If we're auto saving, mark the body as not changed here, and not
// when the save is done, because the user might change it between now
// and when the save is done.
else
{
SetContentAndBodyAsUnmodified();
}
- var progress = Components.classes["@mozilla.org/messenger/progress;1"]
- .createInstance(Components.interfaces.nsIMsgProgress);
+ var progress = Cc["@mozilla.org/messenger/progress;1"]
+ .createInstance(Ci.nsIMsgProgress);
if (progress)
{
progress.registerListener(progressListener);
if (msgType == nsIMsgCompDeliverMode.Save ||
msgType == nsIMsgCompDeliverMode.SaveAsDraft ||
msgType == nsIMsgCompDeliverMode.AutoSaveAsDraft ||
msgType == nsIMsgCompDeliverMode.SaveAsTemplate)
gSaveOperationInProgress = true;
@@ -3412,17 +3412,17 @@ function GenericSendMessage(msgType)
gSendOperationInProgress = true;
}
msgWindow.domWindow = window;
msgWindow.rootDocShell.allowAuth = true;
gMsgCompose.SendMsg(msgType, getCurrentIdentity(),
getCurrentAccountKey(), msgWindow, progress);
}
catch (ex) {
- Components.utils.reportError("GenericSendMessage FAILED: " + ex);
+ Cu.reportError("GenericSendMessage FAILED: " + ex);
ToggleWindowLock(false);
}
if (gMsgCompose && originalCharset != gMsgCompose.compFields.characterSet)
SetDocumentCharacterSet(gMsgCompose.compFields.characterSet);
}
/**
* Check if the given address is valid (contains a @).
@@ -3899,18 +3899,18 @@ function showPopupById(aPopupID, aAnchor
}
function InitLanguageMenu()
{
var languageMenuList = document.getElementById('languageMenuList');
if (!languageMenuList)
return;
- var spellChecker = Components.classes['@mozilla.org/spellchecker/engine;1']
- .getService(mozISpellCheckingEngine);
+ var spellChecker = Cc['@mozilla.org/spellchecker/engine;1']
+ .getService(mozISpellCheckingEngine);
var o1 = {};
var o2 = {};
// Get the list of dictionaries from
// the spellchecker.
spellChecker.getDictionaryList(o1, o2);
@@ -4101,17 +4101,17 @@ function FillIdentityList(menulist)
{
let accounts = allAccountsSorted(true);
let accountHadSeparator = false;
let firstAccountWithIdentities = true;
for (let acc = 0; acc < accounts.length; acc++) {
let account = accounts[acc];
let identities = toArray(fixIterator(account.identities,
- Components.interfaces.nsIMsgIdentity));
+ Ci.nsIMsgIdentity));
if (identities.length == 0)
continue;
let needSeparator = (identities.length > 1);
if (needSeparator || accountHadSeparator) {
// Separate identities from this account from the previous
// account's identities if there is more than 1 in the current
@@ -4279,17 +4279,17 @@ function ComposeCanClose()
// ourselves. If we don't tell toolkit that, and then close the window
// ourselves, the toolkit code that keeps track of the open windows
// gets off by one and the app can close unexpectedly on os's that
// shutdown the app when the last window is closed.
try {
GenericSendMessage(nsIMsgCompDeliverMode.AutoSaveAsDraft);
}
catch (ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
return false;
case 1: //Cancel
return false;
case 2: //Don't Save
// don't delete the draft if we didn't start off editing a draft
// and the user hasn't explicitly saved it.
if (!gEditingDraft && gAutoSaveKickedIn)
@@ -4302,33 +4302,33 @@ function ComposeCanClose()
}
function RemoveDraft()
{
try
{
var draftUri = gMsgCompose.compFields.draftId;
var msgKey = draftUri.substr(draftUri.indexOf('#') + 1);
- var rdf = Components.classes['@mozilla.org/rdf/rdf-service;1']
- .getService(Components.interfaces.nsIRDFService);
+ var rdf = Cc['@mozilla.org/rdf/rdf-service;1']
+ .getService(Ci.nsIRDFService);
var folder = rdf.GetResource(gMsgCompose.savedFolderURI)
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
try {
- if (folder.flags & Components.interfaces.nsMsgFolderFlags.Drafts)
+ if (folder.flags & Ci.nsMsgFolderFlags.Drafts)
{
- var msgs = Components.classes["@mozilla.org/array;1"].
- createInstance(Components.interfaces.nsIMutableArray);
+ var msgs = Cc["@mozilla.org/array;1"].
+ createInstance(Ci.nsIMutableArray);
msgs.appendElement(folder.GetMessageHeader(msgKey));
folder.deleteMessages(msgs, null, true, false, null, false);
}
}
catch (ex) // couldn't find header - perhaps an imap folder.
{
- var imapFolder = folder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ var imapFolder = folder.QueryInterface(Ci.nsIMsgImapMailFolder);
var keyArray = new Array;
keyArray[0] = msgKey;
imapFolder.storeImapFlags(8, true, keyArray, 1, null);
}
} catch (ex) {}
}
function SetContentAndBodyAsUnmodified()
@@ -4347,82 +4347,82 @@ function MsgComposeCloseWindow()
function GetLastAttachDirectory()
{
var lastDirectory;
try {
lastDirectory = Services.prefs
.getComplexValue(kComposeAttachDirPrefName,
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
}
catch (ex) {
// this will fail the first time we attach a file
// as we won't have a pref value.
lastDirectory = null;
}
return lastDirectory;
}
// attachedLocalFile must be a nsIFile
function SetLastAttachDirectory(attachedLocalFile)
{
try {
- let file = attachedLocalFile.QueryInterface(Components.interfaces.nsIFile);
- let parent = file.parent.QueryInterface(Components.interfaces.nsIFile);
+ let file = attachedLocalFile.QueryInterface(Ci.nsIFile);
+ let parent = file.parent.QueryInterface(Ci.nsIFile);
Services.prefs.setComplexValue(kComposeAttachDirPrefName,
- Components.interfaces.nsIFile, parent);
+ Ci.nsIFile, parent);
}
catch (ex) {
dump("error: SetLastAttachDirectory failed: " + ex + "\n");
}
}
function AttachFile()
{
//Get file using nsIFilePicker and convert to URL
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
fp.init(window, getComposeBundle().getString("chooseFileToAttach"),
nsIFilePicker.modeOpenMultiple);
var lastDirectory = GetLastAttachDirectory();
if (lastDirectory)
fp.displayDirectory = lastDirectory;
fp.appendFilters(nsIFilePicker.filterAll);
fp.open(rv => {
- if (rv != Components.interfaces.nsIFilePicker.returnOK || !fp.files)
+ if (rv != Ci.nsIFilePicker.returnOK || !fp.files)
return;
let file;
let attachments = [];
- for (file of fixIterator(fp.files, Components.interfaces.nsIFile))
+ for (file of fixIterator(fp.files, Ci.nsIFile))
attachments.push(FileToAttachment(file));
AddAttachments(attachments);
SetLastAttachDirectory(file);
});
}
/**
* Convert an nsIFile instance into an nsIMsgAttachment.
*
* @param file the nsIFile
* @return an attachment pointing to the file
*/
function FileToAttachment(file)
{
let fileHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
- let attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"]
- .createInstance(Components.interfaces.nsIMsgAttachment);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
+ let attachment = Cc["@mozilla.org/messengercompose/attachment;1"]
+ .createInstance(Ci.nsIMsgAttachment);
attachment.url = fileHandler.getURLSpecFromFile(file);
attachment.size = file.fileSize;
return attachment;
}
/**
* Add a list of attachment objects as attachments. The attachment URLs must be
@@ -4432,22 +4432,22 @@ function FileToAttachment(file)
* attachments. Anything iterable with fixIterator is accepted.
* @param aCallback an optional callback function called immediately after
* adding each attachment. Takes one argument: the newly-added
* <attachmentitem> node.
*/
function AddAttachments(aAttachments, aCallback)
{
let bucket = document.getElementById("attachmentBucket");
- let addedAttachments = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let addedAttachments = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
let items = [];
for (let attachment of fixIterator(aAttachments,
- Components.interfaces.nsIMsgAttachment)) {
+ Ci.nsIMsgAttachment)) {
if (!(attachment && attachment.url) ||
DuplicateFileAlreadyAttached(attachment.url))
continue;
if (!attachment.name)
attachment.name = gMsgCompose.AttachmentPrettyName(attachment.url, null);
// For security reasons, don't allow *-message:// uris to leak out.
@@ -4485,17 +4485,17 @@ function AddAttachments(aAttachments, aC
// For local file urls, we are better off using the full file url because
// moz-icon will actually resolve the file url and get the right icon from
// the file url. All other urls, we should try to extract the file name from
// them. This fixes issues where an icon wasn't showing up if you dragged a
// web url that had a query or reference string after the file name and for
// mailnews urls where the filename is hidden in the url as a &filename=
// part.
let url = Services.io.newURI(attachment.url);
- if (url instanceof Components.interfaces.nsIURL &&
+ if (url instanceof Ci.nsIURL &&
url.fileName && !url.schemeIs("file")) {
item.image = "moz-icon://" + url.fileName;
} else if (/^mailbox-message:|^imap-message:|^news-message:/i.test(attachment.url)) {
// We're attaching a message, most likely via drag and drop. Pretend that is comes
// from a file, so we get the icon that matches .eml files.
item.image = "moz-icon://message.eml";
} else {
item.image = "moz-icon:" + attachment.url;
@@ -4659,18 +4659,18 @@ function AttachPage()
{
if (result.value.length <= "http://".length)
{
// Nothing filled, just show the dialog again.
AttachPage();
return;
}
- let attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"]
- .createInstance(Components.interfaces.nsIMsgAttachment);
+ let attachment = Cc["@mozilla.org/messengercompose/attachment;1"]
+ .createInstance(Ci.nsIMsgAttachment);
attachment.url = result.value;
AddAttachments([attachment]);
}
}
/**
* Check if the given fileURL already exists in the attachment bucket.
* @param fileURL the URL (as a String) of the file to check
@@ -4703,18 +4703,18 @@ function Attachments2CompFields(compFiel
if (attachment)
compFields.addAttachment(attachment);
}
}
function RemoveAllAttachments()
{
let bucket = document.getElementById("attachmentBucket");
- let removedAttachments = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let removedAttachments = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
while (bucket.getRowCount())
{
let child = bucket.removeItemAt(bucket.getRowCount() - 1);
removedAttachments.appendElement(child.attachment);
// Let's release the attachment object hold by the node else it won't go
// away until the window is destroyed
@@ -4756,19 +4756,19 @@ function UpdateAttachmentBucket(aShowPan
function RemoveSelectedAttachment()
{
let bucket = document.getElementById("attachmentBucket");
if (bucket.selectedItems.length > 0) {
// Remember the current focus index so we can try to restore it when done.
let focusIndex = bucket.currentIndex;
let fileHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
- let removedAttachments = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
+ let removedAttachments = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
for (let i = bucket.selectedCount - 1; i >= 0; i--) {
let item = bucket.removeItemAt(bucket.getIndexOfItem(bucket.getSelectedItem(i)));
if (item.attachment.size != -1) {
gAttachmentsSize -= item.attachment.size;
UpdateAttachmentBucket(true);
}
@@ -5249,41 +5249,41 @@ function OpenSelectedAttachment()
// Turn the URL into a nsIURI object then open it.
let uri = Services.io.newURI(attachmentUrl);
if (uri)
{
let channel = Services.io.newChannelFromURI2(uri,
null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
if (channel)
{
- let uriLoader = Components.classes["@mozilla.org/uriloader;1"].getService(Components.interfaces.nsIURILoader);
+ let uriLoader = Cc["@mozilla.org/uriloader;1"].getService(Ci.nsIURILoader);
uriLoader.openURI(channel, true, new nsAttachmentOpener());
}
}
}
} // if one attachment selected
}
function nsAttachmentOpener()
{
}
nsAttachmentOpener.prototype =
{
QueryInterface: function(iid)
{
- if (iid.equals(Components.interfaces.nsIURIContentListener) ||
- iid.equals(Components.interfaces.nsIInterfaceRequestor) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIURIContentListener) ||
+ iid.equals(Ci.nsIInterfaceRequestor) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
onStartURIOpen: function(uri)
{
return false;
},
doContent: function(contentType, isContentPreferred, request, contentHandler)
@@ -5298,22 +5298,22 @@ nsAttachmentOpener.prototype =
canHandleContent: function(contentType, isContentPreferred, desiredContentType)
{
return false;
},
getInterface: function(iid)
{
- if (iid.equals(Components.interfaces.nsIDOMWindow)) {
+ if (iid.equals(Ci.nsIDOMWindow)) {
return window;
- } else if (iid.equals(Components.interfaces.nsIDocShell)) {
- return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell);
+ } else if (iid.equals(Ci.nsIDocShell)) {
+ return window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell);
} else {
return this.QueryInterface(iid);
}
},
loadCookie: null,
parentContentListener: null
}
@@ -5361,17 +5361,17 @@ function DetermineConvertibility()
*
* @param aAccountKey Key of the account that is currently selected
* as the sending account.
*/
function hideIrrelevantAddressingOptions(aAccountKey)
{
let hideNews = true;
for (let account of fixIterator(MailServices.accounts.accounts,
- Components.interfaces.nsIMsgAccount)) {
+ Ci.nsIMsgAccount)) {
if (account.incomingServer.type == "nntp")
hideNews = false;
}
// If there is no News (NNTP) account existing then
// hide the Newsgroup and Followup-To recipient type in all the menulists.
let addrWidget = document.getElementById("addressingWidget");
// Only really touch the News related items we know about.
let newsTypes = addrWidget
@@ -5802,17 +5802,17 @@ var envelopeDragObserver = {
// when using 'let'.
switch (item.flavour.contentType)
{
// Process attachments.
case "application/x-moz-file": {
isValidAttachment = true;
let fileHandler = Services.io
.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
size = rawData.fileSize;
rawData = fileHandler.getURLSpecFromFile(rawData);
break;
}
case "text/x-moz-message": {
isValidAttachment = true;
@@ -5856,18 +5856,18 @@ var envelopeDragObserver = {
aEvent.preventDefault();
}
break;
}
}
// Create the attachment and add it to attachments array.
if (isValidAttachment) {
- let attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"]
- .createInstance(Components.interfaces.nsIMsgAttachment);
+ let attachment = Cc["@mozilla.org/messengercompose/attachment;1"]
+ .createInstance(Ci.nsIMsgAttachment);
attachment.url = rawData;
attachment.name = prettyName;
if (size !== undefined)
attachment.size = size;
attachments.push(attachment);
}
@@ -6343,17 +6343,17 @@ var gAttachmentNotifier =
this.enabled = getPref("mail.compose.attachment_reminder");
if (!this.enabled)
return;
this._obs = new MutationObserver(function gAN_handleMutations(aMutations) {
gAttachmentNotifier.timer.cancel();
gAttachmentNotifier.timer.initWithCallback(gAttachmentNotifier.event, 500,
- Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ Ci.nsITimer.TYPE_ONE_SHOT);
});
this._obs.observe(aDocument, {
attributes: true,
childList: true,
characterData: true,
subtree: true,
});
@@ -6368,17 +6368,17 @@ var gAttachmentNotifier =
this.event.notify();
},
// Timer based function triggered by the inputEventListener
// for the subject field.
subjectObserver: function handleEvent() {
gAttachmentNotifier.timer.cancel();
gAttachmentNotifier.timer.initWithCallback(gAttachmentNotifier.event, 500,
- Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ Ci.nsITimer.TYPE_ONE_SHOT);
},
/**
* Checks for new keywords synchronously and run the usual handler.
*
* @param aManage Determines whether to manage the notification according to keywords found.
*/
redetectKeywords: function(aManage) {
@@ -6407,17 +6407,17 @@ var gAttachmentNotifier =
// we can skip the expensive checking of keywords in the message.
// but mark it in the .lastMessage that the keywords are unknown.
attachmentWorker.lastMessage = null;
return (async ? null : []);
}
let keywordsInCsv = Services.prefs.getComplexValue(
"mail.compose.attachment_reminder_keywords",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
let mailBody = getBrowser().contentDocument.querySelector("body");
// We use a new document and import the body into it. We do that to avoid
// loading images that were previously blocked. Content policy of the newly
// created data document will block the loads. Details: Bug 1409458 comment #22.
let newDoc = getBrowser().contentDocument.implementation.createDocument("", "", null);
let mailBodyNode = newDoc.importNode(mailBody, true);
@@ -6502,18 +6502,18 @@ var gAttachmentNotifier =
if (gMsgCompose) {
// This runs the attachmentWorker asynchronously so if keywords are found
// manageAttachmentNotification is run from attachmentWorker.onmessage.
gAttachmentNotifier._checkForAttachmentKeywords(true);
}
}
},
- timer: Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer)
+ timer: Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer)
};
/**
* Helper function to remove a query part from a URL, so for example:
* ...?remove=xx&other=yy becomes ...?other=yy.
*
* @param aURL the URL from which to remove the query part
* @param aQuery the query part to remove
@@ -6539,17 +6539,17 @@ function removeQueryPart(aURL, aQuery)
function InitEditor()
{
var editor = GetCurrentEditor();
// Set eEditorMailMask flag to avoid using content prefs for spell checker,
// otherwise dictionary setting in preferences is ignored and dictionary is
// inconsistent in subject and message body.
- let eEditorMailMask = Components.interfaces.nsIPlaintextEditor.eEditorMailMask;
+ let eEditorMailMask = Ci.nsIPlaintextEditor.eEditorMailMask;
editor.flags |= eEditorMailMask;
GetMsgSubjectElement().editor.flags |= eEditorMailMask;
// Control insertion of line breaks.
editor.returnInParagraphCreatesNewParagraph =
Services.prefs.getBoolPref("editor.CR_creates_new_p");
editor.document.execCommand("defaultparagraphseparator", false,
gMsgCompose.composeHTML &&
@@ -6597,43 +6597,43 @@ function InitEditor()
let src = event.target.src;
if (!src) {
return;
}
if (!/^file:/i.test(src)) {
// Check if this is a protocol that can fetch parts.
let protocol = src.substr(0, src.indexOf(":")).toLowerCase();
if (!(Services.io.getProtocolHandler(protocol) instanceof
- Components.interfaces.nsIMsgMessageFetchPartService)) {
+ Ci.nsIMsgMessageFetchPartService)) {
// Can't fetch parts, don't try to load.
return;
}
}
if (event.target.classList.contains("loading-internal")) {
// We're already loading this, or tried so unsuccesfully.
return;
}
if (gOriginalMsgURI) {
- let msgSvc = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger)
+ let msgSvc = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger)
.messageServiceFromURI(gOriginalMsgURI);
let originalMsgNeckoURI = {};
msgSvc.GetUrlForUri(gOriginalMsgURI, originalMsgNeckoURI, null);
if (src.startsWith(removeQueryPart(originalMsgNeckoURI.value.spec,
"type=application/x-message-display"))) {
// Reply/Forward/Edit Draft/Edit as New can contain references to
// images in the original message. Load those and make them data: URLs
// now.
event.target.classList.add("loading-internal");
try {
loadBlockedImage(src);
} catch (e) {
// Couldn't load the referenced image.
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
else {
// Appears to reference a random message. Notify and keep blocking.
gComposeNotificationBar.setBlockedContent(src);
}
}
else {
@@ -6642,29 +6642,29 @@ function InitEditor()
gComposeNotificationBar.setBlockedContent(src);
}
}, true);
// Convert mailnews URL back to data: URL.
let background = editor.document.body.background;
if (background && gOriginalMsgURI) {
// Check that background has the same URL as the message itself.
- let msgSvc = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger)
+ let msgSvc = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger)
.messageServiceFromURI(gOriginalMsgURI);
let originalMsgNeckoURI = {};
msgSvc.GetUrlForUri(gOriginalMsgURI, originalMsgNeckoURI, null);
if (background.startsWith(
removeQueryPart(originalMsgNeckoURI.value.spec,
"type=application/x-message-display"))) {
try {
editor.document.body.background = loadBlockedImage(background, true);
} catch (e) {
// Couldn't load the referenced image.
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
}
}
// This is used as event listener to spellcheck-changed event to update
// document language.
function updateDocumentLanguage(e)
@@ -6869,17 +6869,17 @@ function onBlockedContentOptionsShowing(
* @param {Node} aNode - the node holding as value the URLs of the blocked
* resources in the message (space separated).
*/
function onUnblockResource(aURL, aNode) {
try {
loadBlockedImage(aURL);
} catch (e) {
// Couldn't load the referenced image.
- Components.utils.reportError(e);
+ Cu.reportError(e);
} finally {
// Remove it from the list on success and failure.
let urls = aNode.value.split(" ");
for (let i = 0; i < urls.length; i++) {
if (urls[i] == aURL) {
urls.splice(i, 1);
aNode.value = urls.join(" ");
if (urls.length == 0) {
@@ -6909,18 +6909,18 @@ function loadBlockedImage(aURL, aReturnD
let fnMatch = /[?&;]filename=([^?&]+)/.exec(aURL);
filename = (fnMatch && fnMatch[1]) || "";
}
filename = decodeURIComponent(filename);
let uri = Services.io.newURI(aURL);
let contentType;
if (filename) {
try {
- contentType = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService)
+ contentType = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService)
.getTypeFromURI(uri);
} catch (ex) {
contentType = "image/png";
}
if (!contentType.startsWith("image/")) {
// Unsafe to unblock this. It would just be garbage either way.
throw new Error("Won't unblock; URL=" + aURL +
@@ -6930,21 +6930,21 @@ function loadBlockedImage(aURL, aReturnD
else {
// Assuming image/png is the best we can do.
contentType = "image/png";
}
let channel = Services.io.newChannelFromURI2(uri,
null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
let inputStream = channel.open();
- let stream = Components.classes["@mozilla.org/binaryinputstream;1"]
- .createInstance(Components.interfaces.nsIBinaryInputStream);
+ let stream = Cc["@mozilla.org/binaryinputstream;1"]
+ .createInstance(Ci.nsIBinaryInputStream);
stream.setInputStream(inputStream);
let streamData = "";
try {
while (stream.available() > 0) {
streamData += stream.readBytes(stream.available());
}
} catch(e) {
stream.close();
--- a/mail/components/compose/content/addressingWidgetOverlay.js
+++ b/mail/components/compose/content/addressingWidgetOverlay.js
@@ -9,18 +9,18 @@ ChromeUtils.import("resource:///modules/
top.MAX_RECIPIENTS = 1; /* for the initial listitem created in the XUL */
var inputElementType = "";
var selectElementType = "";
var selectElementIndexTable = null;
var gNumberOfCols = 0;
-var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"]
- .getService(Components.interfaces.nsIDragService);
+var gDragService = Cc["@mozilla.org/widget/dragservice;1"]
+ .getService(Ci.nsIDragService);
var test_addresses_sequence = false;
try {
if (sPrefs)
test_addresses_sequence = sPrefs.getBoolPref("mail.debug.test_addresses_sequence");
}
catch (ex) {}
@@ -793,29 +793,29 @@ function DragOverAddressingWidget(event)
if (validFlavor)
dragSession.canDrop = true;
}
function DropOnAddressingWidget(event)
{
var dragSession = gDragService.getCurrentSession();
- var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
+ var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
trans.init(getLoadContext());
trans.addDataFlavor("text/x-moz-address");
for ( var i = 0; i < dragSession.numDropItems; ++i )
{
dragSession.getData ( trans, i );
var dataObj = new Object();
var bestFlavor = new Object();
var len = new Object();
trans.getAnyTransferData ( bestFlavor, dataObj, len );
if ( dataObj )
- dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsString);
+ dataObj = dataObj.value.QueryInterface(Ci.nsISupportsString);
if ( !dataObj )
continue;
// pull the address out of the data object
var address = dataObj.data.substring(0, len.value);
if (!address)
continue;
@@ -1157,31 +1157,31 @@ AutomatedAutoCompleteHandler.prototype =
for (sessionIndex in this.searchResults)
{
searchResultsForSession = this.searchResults[sessionIndex];
if (searchResultsForSession && searchResultsForSession.defaultItemIndex > -1)
{
addressToAdd = searchResultsForSession.items
.queryElementAt(searchResultsForSession.defaultItemIndex,
- Components.interfaces.nsIAutoCompleteItem).value;
+ Ci.nsIAutoCompleteItem).value;
break;
}
}
// still no match? loop through looking for the -1 default index
if (!addressToAdd)
{
for (sessionIndex in this.searchResults)
{
searchResultsForSession = this.searchResults[sessionIndex];
if (searchResultsForSession && searchResultsForSession.defaultItemIndex == -1)
{
addressToAdd = searchResultsForSession.items
- .queryElementAt(0, Components.interfaces.nsIAutoCompleteItem).value;
+ .queryElementAt(0, Ci.nsIAutoCompleteItem).value;
break;
}
}
}
// no matches anywhere...just use what we were given
if (!addressToAdd)
addressToAdd = this.namesToComplete[this.indexIntoNames];
@@ -1196,21 +1196,21 @@ AutomatedAutoCompleteHandler.prototype =
{
// This will now append all the recipients, set the focus on a new
// available row, and make sure it is visible.
awAddRecipientsArray(this.recipientType, this.finalAddresses);
},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIAutoCompleteListener) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIAutoCompleteListener) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
}
// Returns the load context for the current window
function getLoadContext() {
- return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsILoadContext);
+ return window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsILoadContext);
}
--- a/mail/components/compose/content/bigFileObserver.js
+++ b/mail/components/compose/content/bigFileObserver.js
@@ -78,36 +78,36 @@ var gBigFileObserver = {
return str;
},
attachmentsAdded: function(aAttachments) {
let threshold = Services.prefs.getIntPref(
"mail.compose.big_attachments.threshold_kb") * 1024;
for (let attachment of fixIterator(
- aAttachments, Components.interfaces.nsIMsgAttachment)) {
+ aAttachments, Ci.nsIMsgAttachment)) {
if (attachment.size >= threshold && !attachment.sendViaCloud)
this.bigFiles.push(attachment);
}
},
attachmentsRemoved: function(aAttachments) {
for (let attachment of fixIterator(
- aAttachments, Components.interfaces.nsIMsgAttachment)) {
+ aAttachments, Ci.nsIMsgAttachment)) {
let index = this.bigFiles.indexOf(attachment);
if (index != -1)
this.bigFiles.splice(index, 1);
}
},
attachmentsConverted: function(aAttachments) {
let uploaded = [];
for (let attachment of fixIterator(
- aAttachments, Components.interfaces.nsIMsgAttachment)) {
+ aAttachments, Ci.nsIMsgAttachment)) {
if (attachment.sendViaCloud) {
this.attachmentsRemoved([attachment]);
uploaded.push(attachment);
}
}
if (uploaded.length)
this.showUploadingNotification(uploaded);
--- a/mail/components/compose/content/cloudAttachmentLinkManager.js
+++ b/mail/components/compose/content/cloudAttachmentLinkManager.js
@@ -43,17 +43,17 @@ var gCloudAttachmentLinkManager = {
else if (event.type == "attachments-removed" ||
event.type == "attachments-converted") {
let items = [];
let list = mailDoc.getElementById("cloudAttachmentList");
if (list)
items = list.getElementsByClassName("cloudAttachmentItem");
for (let attachment of fixIterator(
- event.detail, Components.interfaces.nsIMsgAttachment)) {
+ event.detail, Ci.nsIMsgAttachment)) {
// Remove the attachment from the message body.
if (list)
for (let i = 0; i < items.length; i++)
if (items[i].contentLocation == attachment.contentLocation)
items[i].remove();
// Now, remove the attachment from our internal list.
let index = this.cloudAttachments.indexOf(attachment);
@@ -407,17 +407,17 @@ var gCloudAttachmentLinkManager = {
providerIcon.src = aProvider.iconClass;
} else {
try {
// Let's use the goodness from MsgComposeCommands.js since we're
// sitting right in a compose window.
providerIcon.src = window.loadBlockedImage(aProvider.iconClass, true);
} catch (e) {
// Couldn't load the referenced image.
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
}
if (aProvider.serviceURL) {
let providerLink = this._generateLink(aDocument, aProvider.displayName,
aProvider.serviceURL);
providerIdentity.appendChild(providerLink);
--- a/mail/components/im/content/chat-messenger-overlay.js
+++ b/mail/components/im/content/chat-messenger-overlay.js
@@ -324,18 +324,18 @@ var chatHandler = {
chatButton.badgeCount = unreadTargettedCount;
if (unreadTotalCount)
chatButton.setAttribute("unreadMessages", "true");
else
chatButton.removeAttribute("unreadMessages");
if (unreadTargettedCount != this._notifiedUnreadCount) {
- let unreadInt = Components.classes["@mozilla.org/supports-PRInt32;1"]
- .createInstance(Ci.nsISupportsPRInt32);
+ let unreadInt = Cc["@mozilla.org/supports-PRInt32;1"]
+ .createInstance(Ci.nsISupportsPRInt32);
unreadInt.data = unreadTargettedCount;
Services.obs.notifyObservers(unreadInt, "unread-im-count-changed", unreadTargettedCount);
this._notifiedUnreadCount = unreadTargettedCount;
}
},
countUnreadMessages: function() {
let convs = imServices.conversations.getUIConversations();
--- a/mail/components/im/content/imAccountWizard.js
+++ b/mail/components/im/content/imAccountWizard.js
@@ -389,27 +389,27 @@ var accountWizard = {
/* Check for correctness and set URL for the "Get more protocols..."-link
* Stripped down code from preferences/themes.js
*/
setGetMoreProtocols: function (){
let prefURL = PREF_EXTENSIONS_GETMOREPROTOCOLSURL;
var getMore = document.getElementById("getMoreProtocols");
var showGetMore = false;
- const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
+ const nsIPrefBranch = Ci.nsIPrefBranch;
if (Services.prefs.getPrefType(prefURL) != nsIPrefBranch.PREF_INVALID) {
try {
var getMoreURL = Services.urlFormatter.formatURLPref(prefURL);
getMore.setAttribute("getMoreURL", getMoreURL);
showGetMore = getMoreURL != "about:blank";
}
catch (e) { }
}
getMore.hidden = !showGetMore;
},
openURL: function (aURL) {
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
- .loadURI(Services.io.newURI(aURL));
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(Services.io.newURI(aURL));
}
};
--- a/mail/components/im/content/imStatusSelector.js
+++ b/mail/components/im/content/imStatusSelector.js
@@ -181,19 +181,19 @@ var statusSelector = {
// binding has been detached, otherwise the focus gets lost (it's
// on none of the elements in the document), but before that we
// need to flush the layout.
elt.getBoundingClientRect();
elt.focus();
},
userIconClick: function ss_userIconClick() {
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- let fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ let fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
let bundle = document.getElementById("chatBundle");
fp.init(window, bundle.getString("userIconFilePickerTitle"),
nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterImages);
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.file) {
return;
}
--- a/mail/components/im/content/imconversation.xml
+++ b/mail/components/im/content/imconversation.xml
@@ -257,19 +257,19 @@
this._conv.systemMessage(
this.bundle.formatStringFromName("unknownCommand", [cmd], 1),
true);
return;
}
}
}
- let msg = Components.classes["@mozilla.org/txttohtmlconv;1"]
- .getService(Ci.mozITXTToHTMLConv)
- .scanTXT(aMsg, 0);
+ let msg = Cc["@mozilla.org/txttohtmlconv;1"]
+ .getService(Ci.mozITXTToHTMLConv)
+ .scanTXT(aMsg, 0);
if (account.HTMLEnabled) {
msg = msg.replace(/\n/g, "<br/>");
if (Services.prefs.getBoolPref("messenger.conversations.sendFormat")) {
let style = MessageFormat.getMessageStyle();
let proto = this._conv.account.protocol.id;
if (proto == "prpl-msn") {
if ("color" in style)
--- a/mail/components/im/imIncomingServer.js
+++ b/mail/components/im/imIncomingServer.js
@@ -257,37 +257,37 @@ imIncomingServer.prototype = {
server: this,
get URI() { return this.server.serverURI; },
get prettyName() { return this.server.prettyName; }, // used in the account manager tree
get name() { return this.server.prettyName + " name"; }, // never displayed?
// used in the folder pane tree, if we don't hide the IM accounts:
get abbreviatedName() { return this.server.prettyName + "abbreviatedName"; },
AddFolderListener: function() {},
RemoveFolderListener: function() {},
- descendants: Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIArray),
+ descendants: Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIArray),
ListDescendants: function(descendants) {},
getFlag: () => false,
getFolderWithFlags: aFlags => null,
getFoldersWithFlags: aFlags =>
- Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIArray),
+ Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIArray),
get subFolders() { return EmptyEnumerator; },
getStringProperty: aPropertyName => "",
getNumUnread: aDeep => 0,
Shutdown: function() {},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMsgFolder])
});
},
get sortOrder() { return 300000000; },
get protocolInfo() {
- return Components.classes["@mozilla.org/messenger/protocol/info;1?type=im"]
- .getService(Components.interfaces.nsIMsgProtocolInfo);
+ return Cc["@mozilla.org/messenger/protocol/info;1?type=im"]
+ .getService(Ci.nsIMsgProtocolInfo);
},
classDescription: "IM Msg Incoming Server implementation",
classID: Components.ID("{9dd7f36b-5960-4f0a-8789-f5f516bd083d}"),
contractID: "@mozilla.org/messenger/server;1?type=im",
QueryInterface: XPCOMUtils.generateQI([Ci.nsIMsgIncomingServer])
};
--- a/mail/components/im/modules/chatHandler.jsm
+++ b/mail/components/im/modules/chatHandler.jsm
@@ -25,31 +25,31 @@ var ChatCore = {
Services.obs.addObserver(this, "contact-signed-on");
Services.obs.addObserver(this, "contact-signed-off");
Services.obs.addObserver(this, "contact-added");
Services.obs.addObserver(this, "contact-removed");
// The initialization of the im core may trigger a master password prompt,
// so wrap it with the async prompter service. Note this service already
// waits for the asynchronous initialization of the password service.
- Components.classes["@mozilla.org/messenger/msgAsyncPrompter;1"]
- .getService(Components.interfaces.nsIMsgAsyncPrompter)
- .queueAsyncAuthPrompt("im", false, {
+ Cc["@mozilla.org/messenger/msgAsyncPrompter;1"]
+ .getService(Ci.nsIMsgAsyncPrompter)
+ .queueAsyncAuthPrompt("im", false, {
onPromptStart: function() {
Services.core.init();
// Find the accounts that exist in the im account service but
// not in nsMsgAccountManager. They have probably been lost if
// the user has used an older version of Thunderbird on a
// profile with IM accounts. See bug 736035.
let accountsById = {};
for (let account of fixIterator(Services.accounts.getAccounts()))
accountsById[account.numericId] = account;
let mgr = MailServices.accounts;
- for (let account of fixIterator(mgr.accounts, Components.interfaces.nsIMsgAccount)) {
+ for (let account of fixIterator(mgr.accounts, Ci.nsIMsgAccount)) {
let incomingServer = account.incomingServer;
if (!incomingServer || incomingServer.type != "im")
continue;
delete accountsById[incomingServer.wrappedJSObject.imAccount.numericId];
}
// Let's recreate each of them...
for (let id in accountsById) {
let account = accountsById[id];
--- a/mail/components/im/modules/index_im.js
+++ b/mail/components/im/modules/index_im.js
@@ -444,17 +444,17 @@ var GlodaIMIndexer = {
let job = new IndexingJob("indexIMConversation", null);
job.conversation = conv;
job.path = logFile;
job.lastModifiedTime = lastModifiedTime;
GlodaIndexer.indexJob(job);
}
conv.logFileCount = logFiles.length;
- }.bind(this)).catch(Components.utils.reportError);
+ }.bind(this)).catch(Cu.reportError);
// Now clear the job, so we can index in the future.
this._knownConversations[convId].scheduledIndex = null;
},
observe: function logger_observe(aSubject, aTopic, aData) {
if (aTopic == "new-ui-conversation") {
// Add ourselves to the ui-conversation's list of observers for the
--- a/mail/components/mailContentHandler.js
+++ b/mail/components/mailContentHandler.js
@@ -10,17 +10,17 @@ var NS_ERROR_WONT_HANDLE_CONTENT = 0x805
function mailContentHandler() {
}
mailContentHandler.prototype = {
classID: Components.ID("{1c73f03a-b817-4640-b984-18c3478a9ae3}"),
_xpcom_factory: {
createInstance: function mch_factory_ci(outer, iid) {
if (outer)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return gMailContentHandler.QueryInterface(iid);
}
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentHandler]),
openInExternal: function mch_OpenInExternal(uri) {
Cc["@mozilla.org/uriloader/external-protocol-service;1"]
@@ -53,17 +53,17 @@ mailContentHandler.prototype = {
this.openInExternal(aRequest.URI);
aRequest.cancel(Cr.NS_BINDING_ABORTED);
},
// nsIFactory
createInstance: function mch_CI(outer, iid) {
if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid);
},
lockFactory: function mch_lock(lock) {
// No-op.
}
};
--- a/mail/components/migration/content/migration.js
+++ b/mail/components/migration/content/migration.js
@@ -1,18 +1,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
-var kIMig = Components.interfaces.nsIMailProfileMigrator;
-var kIPStartup = Components.interfaces.nsIProfileStartup;
+var kIMig = Ci.nsIMailProfileMigrator;
+var kIPStartup = Ci.nsIProfileStartup;
var kProfileMigratorContractIDPrefix = "@mozilla.org/profile/migrator;1?app=mail&type=";
-var nsISupportsString = Components.interfaces.nsISupportsString;
+var nsISupportsString = Ci.nsISupportsString;
var MigrationWizard = {
_source: "", // Source Profile Migrator ContractID suffix
_itemsFlags: kIMig.ALL, // Selected Import Data Sources (16-bit bitfield)
_selectedProfile: null, // Selected Profile name to import from
_wiz: null,
_migrator: null,
_autoMigrate: null,
@@ -73,17 +73,17 @@ var MigrationWizard = {
this._wiz.canAdvance = false;
// Figure out what source apps are are available to import from:
var group = document.getElementById("importSourceGroup");
for (var i = 0; i < group.childNodes.length; ++i) {
var suffix = group.childNodes[i].id;
if (suffix != "nothing") {
var contractID = kProfileMigratorContractIDPrefix + suffix;
- var migrator = Components.classes[contractID].createInstance(kIMig);
+ var migrator = Cc[contractID].createInstance(kIMig);
if (!migrator.sourceExists) {
group.childNodes[i].hidden = true;
if (this._source == suffix) this._source = null;
}
}
}
var firstNonDisabled = null;
@@ -112,17 +112,17 @@ var MigrationWizard = {
if (newSource == "nothing") {
document.documentElement.cancel();
return;
}
if (!this._migrator || (newSource != this._source)) {
// Create the migrator for the selected source.
var contractID = kProfileMigratorContractIDPrefix + newSource;
- this._migrator = Components.classes[contractID].createInstance(kIMig);
+ this._migrator = Cc[contractID].createInstance(kIMig);
this._itemsFlags = kIMig.ALL;
this._selectedProfile = null;
}
this._source = newSource;
// check for more than one source profile
--- a/mail/components/newmailaccount/content/uriListener.js
+++ b/mail/components/newmailaccount/content/uriListener.js
@@ -87,18 +87,18 @@ httpRequestObserver.prototype = {
if (aRequest && aRequest.loadGroup
&& aRequest.loadGroup.notificationCallbacks) {
return aRequest.loadGroup
.notificationCallbacks
.getInterface(Ci.nsILoadContext)
.associatedWindow;
}
} catch(e) {
- Components.utils.reportError("Could not find an associated window "
- + "for an HTTP request. Error: " + e);
+ Cu.reportError("Could not find an associated window "
+ + "for an HTTP request. Error: " + e);
}
return null;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
}
/**
@@ -182,17 +182,17 @@ TracingListener.prototype = {
this.params.realName,
this.params.email);
account = accountCreationFuncs.createAccountInBackend(accountConfig);
success = true;
} catch (e) {
// Something went wrong with account set up. Dump the error out to the
// error console. The tab will be closed, and the Account Provisioner
// tab will be reopened.
- Components.utils.reportError("Problem interpreting provider XML:" + e);
+ Cu.reportError("Problem interpreting provider XML:" + e);
}
tabmail.switchToTab(0);
// Find the tab associated with this browser, and close it.
let myTabInfo = tabmail.tabInfo
.filter((function (x) {
return "browser" in x && x.browser == this.browser;
--- a/mail/components/nsMailDefaultHandler.js
+++ b/mail/components/nsMailDefaultHandler.js
@@ -3,56 +3,56 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
-var nsISupports = Components.interfaces.nsISupports;
+var nsISupports = Ci.nsISupports;
-var nsICommandLine = Components.interfaces.nsICommandLine;
-var nsICommandLineHandler = Components.interfaces.nsICommandLineHandler;
-var nsICommandLineValidator = Components.interfaces.nsICommandLineValidator;
-var nsIDOMWindow = Components.interfaces.nsIDOMWindow;
-var nsIFactory = Components.interfaces.nsIFactory;
-var nsIFileURL = Components.interfaces.nsIFileURL;
-var nsINetUtil = Components.interfaces.nsINetUtil;
-var nsISupportsString = Components.interfaces.nsISupportsString;
-var nsIURILoader = Components.interfaces.nsIURILoader;
+var nsICommandLine = Ci.nsICommandLine;
+var nsICommandLineHandler = Ci.nsICommandLineHandler;
+var nsICommandLineValidator = Ci.nsICommandLineValidator;
+var nsIDOMWindow = Ci.nsIDOMWindow;
+var nsIFactory = Ci.nsIFactory;
+var nsIFileURL = Ci.nsIFileURL;
+var nsINetUtil = Ci.nsINetUtil;
+var nsISupportsString = Ci.nsISupportsString;
+var nsIURILoader = Ci.nsIURILoader;
-var NS_ERROR_ABORT = Components.results.NS_ERROR_ABORT;
+var NS_ERROR_ABORT = Cr.NS_ERROR_ABORT;
-var URI_INHERITS_SECURITY_CONTEXT = Components.interfaces.nsIProtocolHandler
+var URI_INHERITS_SECURITY_CONTEXT = Ci.nsIProtocolHandler
.URI_INHERITS_SECURITY_CONTEXT;
function resolveURIInternal(aCmdLine, aArgument) {
var uri = aCmdLine.resolveURI(aArgument);
if (!(uri instanceof nsIFileURL)) {
return uri;
}
try {
if (uri.file.exists())
return uri;
}
catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
// We have interpreted the argument as a relative file URI, but the file
// doesn't exist. Try URI fixup heuristics: see bug 290782.
try {
uri = Services.uriFixup.createFixupURI(aArgument, 0);
}
catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
return uri;
}
function handleIndexerResult(aFile) {
// Do this here because xpcshell isn't too happy with this at startup
ChromeUtils.import("resource:///modules/MailUtils.js");
@@ -63,86 +63,86 @@ function handleIndexerResult(aFile) {
// message header
ChromeUtils.import("resource:///modules/SearchIntegration.js");
let msgHdr = SearchIntegration.handleResult(aFile);
// If we found a message header, open it, otherwise throw an exception
if (msgHdr)
MailUtils.displayMessage(msgHdr);
else
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
}
function mayOpenURI(uri)
{
- var ext = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ var ext = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
return ext.isExposedProtocol(uri.scheme);
}
function openURI(uri)
{
if (!mayOpenURI(uri))
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
var channel = Services.io.newChannelFromURI2(uri,
null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
- var loader = Components.classes["@mozilla.org/uriloader;1"]
- .getService(Components.interfaces.nsIURILoader);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
+ var loader = Cc["@mozilla.org/uriloader;1"]
+ .getService(Ci.nsIURILoader);
// We cannot load a URI on startup asynchronously without protecting
// the startup
- var loadgroup = Components.classes["@mozilla.org/network/load-group;1"]
- .createInstance(Components.interfaces.nsILoadGroup);
+ var loadgroup = Cc["@mozilla.org/network/load-group;1"]
+ .createInstance(Ci.nsILoadGroup);
var loadlistener = {
onStartRequest: function ll_start(aRequest, aContext) {
Services.startup.enterLastWindowClosingSurvivalArea();
},
onStopRequest: function ll_stop(aRequest, aContext, aStatusCode) {
Services.startup.exitLastWindowClosingSurvivalArea();
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIRequestObserver,
- Components.interfaces.nsISupportsWeakReference])
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIRequestObserver,
+ Ci.nsISupportsWeakReference])
};
loadgroup.groupObserver = loadlistener;
var listener = {
onStartURIOpen: function(uri) { return false; },
doContent: function(ctype, preferred, request, handler) {
- var newHandler = Components.classes["@mozilla.org/uriloader/content-handler;1?type=application/x-message-display"]
- .createInstance(Components.interfaces.nsIContentHandler);
+ var newHandler = Cc["@mozilla.org/uriloader/content-handler;1?type=application/x-message-display"]
+ .createInstance(Ci.nsIContentHandler);
newHandler.handleContent("application/x-message-display", this, request);
return true;
},
isPreferred: function(ctype, desired) {
if (ctype == "message/rfc822")
return true;
return false;
},
canHandleContent: function(ctype, preferred, desired) { return false; },
loadCookie: null,
parentContentListener: null,
getInterface: function(iid) {
- if (iid.equals(Components.interfaces.nsIURIContentListener))
+ if (iid.equals(Ci.nsIURIContentListener))
return this;
- if (iid.equals(Components.interfaces.nsILoadGroup))
+ if (iid.equals(Ci.nsILoadGroup))
return loadgroup;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
};
loader.openURI(channel, true, listener);
}
var nsMailDefaultHandler = {
QueryInterface: XPCOMUtils.generateQI([nsICommandLineHandler,
nsICommandLineValidator,
@@ -183,63 +183,63 @@ var nsMailDefaultHandler = {
case "openinbox":
var win = Services.wm.getMostRecentWindow("mail:3pane");
if (win) {
win.focus();
}
else {
// Bug 277798 - we have to pass an argument to openWindow(), or
// else it won't honor the dialog=no instruction.
- var argstring = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(nsISupportsString);
+ var argstring = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(nsISupportsString);
Services.ww.openWindow(null, "chrome://messenger/content/", "_blank",
"chrome,dialog=no,all", argstring);
}
break;
case "composemessage":
- var argstring = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(nsISupportsString);
+ var argstring = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(nsISupportsString);
remoteParams.shift();
argstring.data = remoteParams.join(",");
Services.ww.openWindow(null, "chrome://messenger/content/messengercompose/messengercompose.xul",
"_blank", "chrome,dialog=no,all", argstring);
break;
default:
- throw Components.results.NS_ERROR_ABORT;
+ throw Cr.NS_ERROR_ABORT;
}
break;
default:
// Somebody sent us a remote command we don't know how to process:
// just abort.
- throw Components.results.NS_ERROR_ABORT;
+ throw Cr.NS_ERROR_ABORT;
}
cmdLine.preventDefault = true;
}
catch (e) {
// If we had a -remote flag but failed to process it, throw
// NS_ERROR_ABORT so that the xremote code knows to return a failure
// back to the handling code.
dump(e);
- throw Components.results.NS_ERROR_ABORT;
+ throw Cr.NS_ERROR_ABORT;
}
}
var chromeParam = cmdLine.handleFlagWithParam("chrome", false);
if (chromeParam) {
try {
var features = "chrome,dialog=no,all";
- var argstring = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(nsISupportsString);
+ var argstring = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(nsISupportsString);
var uri = resolveURIInternal(cmdLine, chromeParam);
- var netutil = Components.classes["@mozilla.org/network/util;1"]
- .getService(nsINetUtil);
+ var netutil = Cc["@mozilla.org/network/util;1"]
+ .getService(nsINetUtil);
// only load URIs which do not inherit chrome privs
if (!netutil.URIChainHasFlags(uri, URI_INHERITS_SECURITY_CONTEXT)) {
Services.ww.openWindow(null, uri.spec, "_blank",
"chrome,dialog=no,all", argstring);
cmdLine.preventDefault = true;
}
}
catch (e) {
@@ -314,36 +314,36 @@ var nsMailDefaultHandler = {
catch (e) {
dump(e);
}
}
if (uri) {
if (uri.toLowerCase().startsWith("feed:")) {
try {
- Components.classes["@mozilla.org/newsblog-feed-downloader;1"]
- .getService(Components.interfaces.nsINewsBlogFeedDownloader)
- .subscribeToFeed(uri, null, null);
+ Cc["@mozilla.org/newsblog-feed-downloader;1"]
+ .getService(Ci.nsINewsBlogFeedDownloader)
+ .subscribeToFeed(uri, null, null);
}
catch (e) {
// If feed handling is not installed, do nothing
}
}
else if (uri.toLowerCase().endsWith(".mozeml") || uri.toLowerCase().endsWith(".wdseml")) {
handleIndexerResult(cmdLine.resolveFile(uri));
cmdLine.preventDefault = true;
}
else if (uri.toLowerCase().endsWith(".eml")) {
// Open this eml in a new message window
let file = cmdLine.resolveFile(uri);
// No point in trying to open a file if it doesn't exist or is empty
if (file.exists() && file.fileSize > 0) {
// Get the URL for this file
let fileURL = Services.io.newFileURI(file)
- .QueryInterface(Components.interfaces.nsIFileURL);
+ .QueryInterface(Ci.nsIFileURL);
fileURL.query = "?type=application/x-message-display";
Services.ww.openWindow(null,
"chrome://messenger/content/messageWindow.xul",
"_blank", "all,chrome,dialog=no,status,toolbar",
fileURL);
cmdLine.preventDefault = true;
}
@@ -383,45 +383,45 @@ var nsMailDefaultHandler = {
"_blank",
"chrome,resizable=no,titlebar,modal,centerscreen",
card);
});
}
}
else {
// This must be a regular filename. Use it to create a new message with attachment.
- let msgParams = Components.classes["@mozilla.org/messengercompose/composeparams;1"]
- .createInstance(Components.interfaces.nsIMsgComposeParams);
- let composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
- .createInstance(Components.interfaces.nsIMsgCompFields);
- let attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"]
- .createInstance(Components.interfaces.nsIMsgAttachment);
- let localFile = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ let msgParams = Cc["@mozilla.org/messengercompose/composeparams;1"]
+ .createInstance(Ci.nsIMsgComposeParams);
+ let composeFields = Cc["@mozilla.org/messengercompose/composefields;1"]
+ .createInstance(Ci.nsIMsgCompFields);
+ let attachment = Cc["@mozilla.org/messengercompose/attachment;1"]
+ .createInstance(Ci.nsIMsgAttachment);
+ let localFile = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
let fileHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
try {
// Unescape the URI so that we work with clients that escape spaces.
localFile.initWithPath(unescape(uri));
attachment.url = fileHandler.getURLSpecFromFile(localFile);
composeFields.addAttachment(attachment);
- msgParams.type = Components.interfaces.nsIMsgCompType.New;
- msgParams.format = Components.interfaces.nsIMsgCompFormat.Default;
+ msgParams.type = Ci.nsIMsgCompType.New;
+ msgParams.format = Ci.nsIMsgCompFormat.Default;
msgParams.composeFields = composeFields;
MailServices.compose.OpenComposeWindowWithParams(null, msgParams);
} catch (e) {
openURI(cmdLine.resolveURI(uri));
}
}
} else {
- var argstring = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(nsISupportsString);
+ var argstring = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(nsISupportsString);
Services.ww.openWindow(null, "chrome://messenger/content/", "_blank",
"chrome,dialog=no,all", argstring);
}
},
/* nsICommandLineValidator */
validate : function mdh_validate(cmdLine) {
@@ -454,31 +454,31 @@ var nsMailDefaultHandler = {
helpInfo : " -options Open the options dialog.\n" +
" -file Open the specified email file.\n",
/* nsIFactory */
createInstance : function mdh_CI(outer, iid) {
if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid);
},
lockFactory : function mdh_lock(lock) {
/* no-op */
}
};
function mailDefaultCommandLineHandler() {}
mailDefaultCommandLineHandler.prototype = {
classDescription: "Mail default commandline handler",
classID: Components.ID("{44346520-c5d2-44e5-a1ec-034e04d7fac4}"),
contractID: "@mozilla.org/mail/clh;1",
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIModule]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIModule]),
_xpcom_factory: nsMailDefaultHandler
}
var NSGetFactory = XPCOMUtils.generateNSGetFactory([mailDefaultCommandLineHandler]);
--- a/mail/components/preferences/advanced.js
+++ b/mail/components/preferences/advanced.js
@@ -73,18 +73,18 @@ var gAdvancedPane = {
let searchCheckbox = document.getElementById("searchIntegration");
searchCheckbox.checked = false;
document.getElementById("searchintegration.enable").disabled = true;
}
// If the shell service is not working, disable the "Check now" button
// and "perform check at startup" checkbox.
try {
- let shellSvc = Components.classes["@mozilla.org/mail/shell-service;1"]
- .getService(Components.interfaces.nsIShellService);
+ let shellSvc = Cc["@mozilla.org/mail/shell-service;1"]
+ .getService(Ci.nsIShellService);
this.mShellServiceWorking = true;
} catch (ex) {
// The elements may not exist if HAVE_SHELL_SERVICE is off.
if (document.getElementById("alwaysCheckDefault")) {
document.getElementById("alwaysCheckDefault").disabled = true;
document.getElementById("alwaysCheckDefault").checked = false;
}
if (document.getElementById("checkDefaultButton"))
@@ -210,27 +210,27 @@ var gAdvancedPane = {
// the page was closed before this callback was executed.
if (!prefStrBundle.getFormattedString) {
return;
}
actualSizeLabel.value = prefStrBundle.getFormattedString("actualDiskCacheSize", size);
},
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsICacheStorageConsumptionObserver,
- Components.interfaces.nsISupportsWeakReference
+ Ci.nsICacheStorageConsumptionObserver,
+ Ci.nsISupportsWeakReference
])
};
actualSizeLabel.value = prefStrBundle.getString("actualDiskCacheSizeCalculated");
try {
let cacheService =
- Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
- .getService(Components.interfaces.nsICacheStorageService);
+ Cc["@mozilla.org/netwerk/cache-storage-service;1"]
+ .getService(Ci.nsICacheStorageService);
cacheService.asyncGetDiskConsumption(this.observer);
} catch (e) {}
},
updateCacheSizeUI: function (smartSizeEnabled)
{
document.getElementById("useCacheBefore").disabled = smartSizeEnabled;
document.getElementById("cacheSize").disabled = smartSizeEnabled;
@@ -267,18 +267,18 @@ var gAdvancedPane = {
},
/**
* Clears the cache.
*/
clearCache: function ()
{
try {
- let cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
- .getService(Components.interfaces.nsICacheStorageService);
+ let cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"]
+ .getService(Ci.nsICacheStorageService);
cache.clear();
} catch (ex) {}
this.updateActualCacheSize();
},
updateButtons: function (aButtonID, aPreferenceID)
{
var button = document.getElementById(aButtonID);
@@ -313,32 +313,32 @@ updateReadPrefs: function ()
if (!enabledPref.value) // Don't care for autoPref.value in this case.
radiogroup.value="manual" // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
radiogroup.value="auto"; // 1. Automatically install updates
else // enabledPref.value && !autoPref.value
radiogroup.value="checkOnly"; // 2. Check, but let me choose
- var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
- getService(Components.interfaces.nsIApplicationUpdateService).
+ var canCheck = Cc["@mozilla.org/updates/update-service;1"].
+ getService(Ci.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
let installed;
try {
- let wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
- .createInstance(Components.interfaces.nsIWindowsRegKey);
+ let wrk = Cc["@mozilla.org/windows-registry-key;1"]
+ .createInstance(Ci.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
installed = wrk.readIntValue("Installed");
wrk.close();
} catch(e) { }
if (installed != 1) {
document.getElementById("useService").hidden = true;
@@ -369,34 +369,34 @@ updateWritePrefs: function ()
}
},
showUpdates: function ()
{
if (this._loadInContent) {
gSubDialog.open("chrome://mozapps/content/update/history.xul");
} else {
- var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
- .createInstance(Components.interfaces.nsIUpdatePrompt);
+ var prompter = Cc["@mozilla.org/updates/update-prompt;1"]
+ .createInstance(Ci.nsIUpdatePrompt);
prompter.showUpdateHistory(window);
}
},
updateCompactOptions: function(aCompactEnabled)
{
document.getElementById("offlineCompactFolderMin").disabled =
!document.getElementById("offlineCompactFolder").checked ||
document.getElementById("mail.purge_threshhold_mb").locked;
},
updateSubmitCrashReports: function(aChecked)
{
- Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
- .getService(Components.interfaces.nsICrashReporter)
- .submitReports = aChecked;
+ Cc["@mozilla.org/toolkit/crash-reporter;1"]
+ .getService(Ci.nsICrashReporter)
+ .submitReports = aChecked;
},
/**
* Display the return receipts configuration dialog.
*/
showReturnReceipts: function()
{
if (this._loadInContent) {
gSubDialog.open("chrome://messenger/content/preferences/receipts.xul",
@@ -507,18 +507,18 @@ updateWritePrefs: function ()
openTextLink: function (evt) {
// Opening links behind a modal dialog is poor form. Work around flawed
// text-link handling by opening in browser if we'd instead get a content
// tab behind the modal options dialog.
if (Services.prefs.getBoolPref("browser.preferences.instantApply")) {
return true; // Yes, open the link in a content tab.
}
var url = evt.target.getAttribute("href");
- var messenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ var messenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
messenger.launchExternalURL(url);
evt.preventDefault();
return false;
},
/**
* Set up or hide the Learn More links for various data collection options
*/
@@ -533,31 +533,31 @@ updateWritePrefs: function ()
el.setAttribute("hidden", "true");
}
},
initSubmitCrashes: function ()
{
var checkbox = document.getElementById("submitCrashesBox");
try {
- var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
- getService(Components.interfaces.nsICrashReporter);
+ var cr = Cc["@mozilla.org/toolkit/crash-reporter;1"].
+ getService(Ci.nsICrashReporter);
checkbox.checked = cr.submitReports;
} catch (e) {
checkbox.style.display = "none";
}
this._setupLearnMoreLink("toolkit.crashreporter.infoURL", "crashReporterLearnMore");
},
updateSubmitCrashes: function ()
{
var checkbox = document.getElementById("submitCrashesBox");
try {
- var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"].
- getService(Components.interfaces.nsICrashReporter);
+ var cr = Cc["@mozilla.org/toolkit/crash-reporter;1"].
+ getService(Ci.nsICrashReporter);
cr.submitReports = checkbox.checked;
} catch (e) { }
},
/**
* The preference/checkbox is configured in XUL.
*
@@ -566,21 +566,21 @@ updateWritePrefs: function ()
initTelemetry: function ()
{
if (AppConstants.MOZ_TELEMETRY_REPORTING)
this._setupLearnMoreLink("toolkit.telemetry.infoURL", "telemetryLearnMore");
},
formatLocaleSetLabels: function() {
const localeService =
- Components.classes["@mozilla.org/intl/localeservice;1"]
- .getService(Components.interfaces.mozILocaleService);
+ Cc["@mozilla.org/intl/localeservice;1"]
+ .getService(Ci.mozILocaleService);
const osprefs =
- Components.classes["@mozilla.org/intl/ospreferences;1"]
- .getService(Components.interfaces.mozIOSPreferences);
+ Cc["@mozilla.org/intl/ospreferences;1"]
+ .getService(Ci.mozIOSPreferences);
let appLocale = localeService.getAppLocalesAsBCP47()[0];
let rsLocale = osprefs.getRegionalPrefsLocales()[0];
appLocale = this.mInlineSpellChecker.getDictionaryDisplayName(appLocale);
rsLocale = this.mInlineSpellChecker.getDictionaryDisplayName(rsLocale);
let appLocaleRadio = document.getElementById("appLocale");
let rsLocaleRadio = document.getElementById("rsLocale");
let appLocaleLabel = this.mBundle.getFormattedString("appLocale.label",
[appLocale]);
--- a/mail/components/preferences/applicationManager.js
+++ b/mail/components/preferences/applicationManager.js
@@ -6,30 +6,30 @@ var gAppManagerDialog = {
_removed: [],
init: function appManager_init() {
this.handlerInfo = window.arguments[0];
var bundle = document.getElementById("appManagerBundle");
var description = gApplicationsPane._describeType(this.handlerInfo);
- var key = (this.handlerInfo.wrappedHandlerInfo instanceof Components.interfaces.nsIMIMEInfo) ?
+ var key = (this.handlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo) ?
"handleFile" : "handleProtocol";
var contentText = bundle.getFormattedString(key, [description]);
contentText = bundle.getFormattedString("descriptionApplications", [contentText]);
document.getElementById("appDescription").textContent = contentText;
var list = document.getElementById("appList");
var apps = this.handlerInfo.possibleApplicationHandlers.enumerate();
while (apps.hasMoreElements()) {
let app = apps.getNext();
if (!gApplicationsPane.isValidHandlerApp(app))
continue;
- app.QueryInterface(Components.interfaces.nsIHandlerApp);
+ app.QueryInterface(Ci.nsIHandlerApp);
var item = list.appendItem(app.name);
item.setAttribute("image", gApplicationsPane._getIconURLForHandlerApp(app));
item.className = "listitem-iconic";
item.app = app;
}
list.selectedIndex = 0;
},
@@ -72,21 +72,21 @@ var gAppManagerDialog = {
var list = document.getElementById("appList");
if (!list.selectedItem) {
document.getElementById("remove").disabled = true;
return;
}
document.getElementById("remove").disabled = false;
var app = list.selectedItem.app;
var address = "";
- if (app instanceof Components.interfaces.nsILocalHandlerApp)
+ if (app instanceof Ci.nsILocalHandlerApp)
address = app.executable.path;
- else if (app instanceof Components.interfaces.nsIWebHandlerApp)
+ else if (app instanceof Ci.nsIWebHandlerApp)
address = app.uriTemplate;
- else if (app instanceof Components.interfaces.nsIWebContentHandlerInfo)
+ else if (app instanceof Ci.nsIWebContentHandlerInfo)
address = app.uri;
document.getElementById("appLocation").value = address;
var bundle = document.getElementById("appManagerBundle");
- var appType = (app instanceof Components.interfaces.nsILocalHandlerApp) ?
+ var appType = (app instanceof Ci.nsILocalHandlerApp) ?
"descriptionLocalApp" : "descriptionWebApp";
document.getElementById("appType").value = bundle.getString(appType);
}
};
--- a/mail/components/preferences/applications.js
+++ b/mail/components/preferences/applications.js
@@ -29,42 +29,42 @@ ChromeUtils.import("resource://gre/modul
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
//****************************************************************************//
// Utilities
function getDisplayNameForFile(aFile) {
if (AppConstants.platform == "win") {
- if (aFile instanceof Components.interfaces.nsILocalFileWin) {
+ if (aFile instanceof Ci.nsILocalFileWin) {
try {
return aFile.getVersionInfoField("FileDescription");
}
catch(ex) {
// fall through to the file name
}
}
}
else if (AppConstants.platform == "macosx") {
- if (aFile instanceof Components.interfaces.nsILocalFileMac) {
+ if (aFile instanceof Ci.nsILocalFileMac) {
try {
return aFile.bundleDisplayName;
}
catch(ex) {
// fall through to the file name
}
}
}
return aFile.leafName;
}
function getLocalHandlerApp(aFile) {
- var localHandlerApp = Components.classes["@mozilla.org/uriloader/local-handler-app;1"]
- .createInstance(Components.interfaces.nsILocalHandlerApp);
+ var localHandlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"]
+ .createInstance(Ci.nsILocalHandlerApp);
localHandlerApp.name = getDisplayNameForFile(aFile);
localHandlerApp.executable = aFile;
return localHandlerApp;
}
/**
* An enumeration of items in a JS array.
@@ -117,21 +117,21 @@ HandlerInfoWrapper.prototype = {
// The wrapped nsIHandlerInfo object. In general, this object is private,
// but there are a couple cases where callers access it directly for things
// we haven't (yet?) implemented, so we make it a public property.
wrappedHandlerInfo: null,
//**************************************************************************//
// Convenience Utils
- _handlerSvc: Components.classes["@mozilla.org/uriloader/handler-service;1"]
- .getService(Components.interfaces.nsIHandlerService),
+ _handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"]
+ .getService(Ci.nsIHandlerService),
- _categoryMgr: Components.classes["@mozilla.org/categorymanager;1"]
- .getService(Components.interfaces.nsICategoryManager),
+ _categoryMgr: Cc["@mozilla.org/categorymanager;1"]
+ .getService(Ci.nsICategoryManager),
//**************************************************************************//
// nsIHandlerInfo
// The MIME type or protocol scheme.
_type: null,
get type() {
return this._type;
@@ -204,22 +204,22 @@ HandlerInfoWrapper.prototype = {
// If the action is to use a helper app, but we don't have a preferred
// handler app, then switch to using the system default, if any; otherwise
// fall back to saving to disk, which is the default action in nsMIMEInfo.
// Note: "save to disk" is an invalid value for protocol info objects,
// but the alwaysAskBeforeHandling getter will detect that situation
// and always return true in that case to override this invalid value.
if (this.wrappedHandlerInfo.preferredAction ==
- Components.interfaces.nsIHandlerInfo.useHelperApp &&
+ Ci.nsIHandlerInfo.useHelperApp &&
!gApplicationsPane.isValidHandlerApp(this.preferredApplicationHandler)) {
if (this.wrappedHandlerInfo.hasDefaultHandler)
- return Components.interfaces.nsIHandlerInfo.useSystemDefault;
+ return Ci.nsIHandlerInfo.useSystemDefault;
else
- return Components.interfaces.nsIHandlerInfo.saveToDisk;
+ return Ci.nsIHandlerInfo.saveToDisk;
}
return this.wrappedHandlerInfo.preferredAction;
},
set preferredAction(aNewValue) {
// We don't modify the preferred action if the new action is to use a plugin
// because handler info objects don't understand our custom "use plugin"
@@ -240,18 +240,18 @@ HandlerInfoWrapper.prototype = {
return false;
// If this is a protocol type and the preferred action is "save to disk",
// which is invalid for such types, then return true here to override that
// action. This could happen when the preferred action is to use a helper
// app, but the preferredApplicationHandler is invalid, and there isn't
// a default handler, so the preferredAction getter returns save to disk
// instead.
- if (!(this.wrappedHandlerInfo instanceof Components.interfaces.nsIMIMEInfo) &&
- this.preferredAction == Components.interfaces.nsIHandlerInfo.saveToDisk)
+ if (!(this.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo) &&
+ this.preferredAction == Ci.nsIHandlerInfo.saveToDisk)
return true;
return this.wrappedHandlerInfo.alwaysAskBeforeHandling;
},
set alwaysAskBeforeHandling(aNewValue) {
this.wrappedHandlerInfo.alwaysAskBeforeHandling = aNewValue;
},
@@ -262,17 +262,17 @@ HandlerInfoWrapper.prototype = {
// The primary file extension associated with this type, if any.
//
// XXX Plugin objects contain an array of MimeType objects with "suffixes"
// properties; if this object has an associated plugin, shouldn't we check
// those properties for an extension?
get primaryExtension() {
try {
- if (this.wrappedHandlerInfo instanceof Components.interfaces.nsIMIMEInfo &&
+ if (this.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo &&
this.wrappedHandlerInfo.primaryExtension)
return this.wrappedHandlerInfo.primaryExtension;
} catch(ex) {}
return null;
},
@@ -371,17 +371,17 @@ HandlerInfoWrapper.prototype = {
get largeIcon() {
return this._getIcon(32);
},
_getIcon: function(aSize) {
if (this.primaryExtension)
return "moz-icon://goat." + this.primaryExtension + "?size=" + aSize;
- if (this.wrappedHandlerInfo instanceof Components.interfaces.nsIMIMEInfo)
+ if (this.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo)
return "moz-icon://goat?size=" + aSize + "&contentType=" + this.type;
// FIXME: consider returning some generic icon when we can't get a URL for
// one (for example in the case of protocol schemes). Filed as bug 395141.
return null;
}
};
@@ -684,17 +684,17 @@ var gCloudFileTab = {
else if (result == Cr.NS_OK) {
this._settingsDeck.selectedPanel = this._settingsPanelWrap;
this._showAccountManagement(account);
}
else if (result == Ci.nsIMsgCloudFileProvider.authErr) {
this._settingsDeck.selectedPanel = this._authErrorPanel;
}
else {
- Components.utils.reportError("Unexpected connection error.");
+ Cu.reportError("Unexpected connection error.");
}
},
_showAccountManagement: function CFT__showAccountManagement(aProvider) {
let iframe = document.createElement('iframe');
iframe.setAttribute("src", aProvider.managementURL);
iframe.setAttribute("flex", "1");
@@ -710,17 +710,17 @@ var gCloudFileTab = {
// When the iframe loads, populate it with the provider.
this._settings.contentWindow.addEventListener("load",
function loadProvider() {
try {
iframe.contentWindow
.wrappedJSObject
.onLoadProvider(aProvider);
} catch(e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}, {capture: false, once: true});
// When the iframe (or any subcontent) fires the DOMContentLoaded event,
// attach the _onClickLink handler to any anchor elements that we can find.
this._settings.contentWindow.addEventListener("DOMContentLoaded",
function addClickListeners(e) {
let doc = e.originalTarget;
@@ -799,20 +799,18 @@ var gCloudFileTab = {
return isNaN(intValue) ? 0 : intValue * 1024;
},
updateThreshold: function CFT_updateThreshold() {
document.getElementById("cloudFileThreshold").disabled =
!document.getElementById("enableThreshold").checked;
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces
- .nsIObserver,
- Components.interfaces
- .nsISupportsWeakReference])
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
+ Ci.nsISupportsWeakReference])
}
//****************************************************************************//
// Prefpane Controller
var gApplicationsPane = {
// The set of types the app knows how to handle. A hash of HandlerInfoWrapper
// objects, indexed by type.
@@ -838,24 +836,24 @@ var gApplicationsPane = {
// Convenience & Performance Shortcuts
// These get defined by init().
_brandShortName : null,
_prefsBundle : null,
_list : null,
_filter : null,
- _mimeSvc : Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService),
+ _mimeSvc : Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService),
- _helperAppSvc : Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
- .getService(Components.interfaces.nsIExternalHelperAppService),
+ _helperAppSvc : Cc["@mozilla.org/uriloader/external-helper-app-service;1"]
+ .getService(Ci.nsIExternalHelperAppService),
- _handlerSvc : Components.classes["@mozilla.org/uriloader/handler-service;1"]
- .getService(Components.interfaces.nsIHandlerService),
+ _handlerSvc : Cc["@mozilla.org/uriloader/handler-service;1"]
+ .getService(Ci.nsIHandlerService),
_loadInContent: Services.prefs.getBoolPref("mail.preferences.inContent"),
//**************************************************************************//
// Initialization & Destruction
init: function() {
// Initialize shortcuts to some commonly accessed elements & values.
@@ -909,22 +907,22 @@ var gApplicationsPane = {
Services.prefs.removeObserver(PREF_HIDE_PLUGINS_WITHOUT_EXTENSIONS, this);
},
//**************************************************************************//
// nsISupports
QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIObserver) ||
- aIID.equals(Components.interfaces.nsIDOMEventListener ||
- aIID.equals(Components.interfaces.nsISupports)))
+ if (aIID.equals(Ci.nsIObserver) ||
+ aIID.equals(Ci.nsIDOMEventListener ||
+ aIID.equals(Ci.nsISupports)))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
//**************************************************************************//
// nsIObserver
observe: function (aSubject, aTopic, aData) {
// Rebuild the list when there are changes to preferences that influence
@@ -1006,17 +1004,17 @@ var gApplicationsPane = {
/**
* Load the set of handlers defined by the application datastore.
*/
_loadApplicationHandlers: function() {
var wrappedHandlerInfos = this._handlerSvc.enumerate();
while (wrappedHandlerInfos.hasMoreElements()) {
let wrappedHandlerInfo =
- wrappedHandlerInfos.getNext().QueryInterface(Components.interfaces.nsIHandlerInfo);
+ wrappedHandlerInfos.getNext().QueryInterface(Ci.nsIHandlerInfo);
let type = wrappedHandlerInfo.type;
let handlerInfoWrapper;
if (type in this._handledTypes) {
handlerInfoWrapper = this._handledTypes[type];
}
else {
handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
@@ -1046,17 +1044,17 @@ var gApplicationsPane = {
// Hide plugins without associated extensions if so prefed so we don't
// show a whole bunch of obscure types handled by plugins on Mac.
// Note: though protocol types don't have extensions, we still show them;
// the pref is only meant to be applied to MIME types, since plugins are
// only associated with MIME types.
// FIXME: should we also check the "suffixes" property of the plugin?
// Filed as bug 395135.
if (hidePluginsWithoutExtensions && handlerInfo.handledOnlyByPlugin &&
- handlerInfo.wrappedHandlerInfo instanceof Components.interfaces.nsIMIMEInfo &&
+ handlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo &&
!handlerInfo.primaryExtension)
continue;
// Hide types handled only by plugins if so prefed.
if (handlerInfo.handledOnlyByPlugin && !showPlugins)
continue;
// We couldn't find any reason to exclude the type, so include it.
@@ -1130,17 +1128,17 @@ var gApplicationsPane = {
* Get the details for the type represented by the given handler info
* object.
*
* @param aHandlerInfo {nsIHandlerInfo} the type to get the extensions for.
* @return {string} the extensions for the type
*/
_typeDetails: function(aHandlerInfo) {
let exts = [];
- if (aHandlerInfo.wrappedHandlerInfo instanceof Components.interfaces.nsIMIMEInfo) {
+ if (aHandlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo) {
let extIter = aHandlerInfo.wrappedHandlerInfo.getFileExtensions();
while(extIter.hasMore()) {
let ext = "."+extIter.getNext();
if (!exts.includes(ext))
exts.push(ext);
}
}
exts.sort();
@@ -1173,53 +1171,53 @@ var gApplicationsPane = {
_describePreferredAction: function(aHandlerInfo) {
// alwaysAskBeforeHandling overrides the preferred action, so if that flag
// is set, then describe that behavior instead. For most types, this is
// the "alwaysAsk" string, but for the feed type we show something special.
if (aHandlerInfo.alwaysAskBeforeHandling)
return this._prefsBundle.getString("alwaysAsk");
switch (aHandlerInfo.preferredAction) {
- case Components.interfaces.nsIHandlerInfo.saveToDisk:
+ case Ci.nsIHandlerInfo.saveToDisk:
return this._prefsBundle.getString("saveFile");
- case Components.interfaces.nsIHandlerInfo.useHelperApp:
+ case Ci.nsIHandlerInfo.useHelperApp:
var preferredApp = aHandlerInfo.preferredApplicationHandler;
var name;
- if (preferredApp instanceof Components.interfaces.nsILocalHandlerApp)
+ if (preferredApp instanceof Ci.nsILocalHandlerApp)
name = getDisplayNameForFile(preferredApp.executable);
else
name = preferredApp.name;
return this._prefsBundle.getFormattedString("useApp", [name]);
- case Components.interfaces.nsIHandlerInfo.handleInternally:
+ case Ci.nsIHandlerInfo.handleInternally:
// For other types, handleInternally looks like either useHelperApp
// or useSystemDefault depending on whether or not there's a preferred
// handler app.
if (this.isValidHandlerApp(aHandlerInfo.preferredApplicationHandler))
return aHandlerInfo.preferredApplicationHandler.name;
return aHandlerInfo.defaultDescription;
// XXX Why don't we say the app will handle the type internally?
// Is it because the app can't actually do that? But if that's true,
// then why would a preferredAction ever get set to this value
// in the first place?
- case Components.interfaces.nsIHandlerInfo.useSystemDefault:
+ case Ci.nsIHandlerInfo.useSystemDefault:
return this._prefsBundle.getFormattedString("useDefault",
[aHandlerInfo.defaultDescription]);
case kActionUsePlugin:
return this._prefsBundle.getFormattedString("usePluginIn",
[aHandlerInfo.plugin.name,
this._brandShortName]);
default:
// Hopefully this never happens.
- Components.utils.reportError("No description for action " + aHandlerInfo.preferredAction + " found!");
+ Cu.reportError("No description for action " + aHandlerInfo.preferredAction + " found!");
return "";
}
},
_selectLastSelectedType: function() {
// If the list is disabled by the pref.downloads.disable_button.edit_actions
// preference being locked, then don't select the type, as that would cause
// it to appear selected, with a different background and an actions menu
@@ -1242,23 +1240,23 @@ var gApplicationsPane = {
* Whether or not the given handler app is valid.
* @param aHandlerApp {nsIHandlerApp} the handler app in question
* @return {boolean} whether or not it's valid
*/
isValidHandlerApp: function(aHandlerApp) {
if (!aHandlerApp)
return false;
- if (aHandlerApp instanceof Components.interfaces.nsILocalHandlerApp)
+ if (aHandlerApp instanceof Ci.nsILocalHandlerApp)
return this._isValidHandlerExecutable(aHandlerApp.executable);
- if (aHandlerApp instanceof Components.interfaces.nsIWebHandlerApp)
+ if (aHandlerApp instanceof Ci.nsIWebHandlerApp)
return aHandlerApp.uriTemplate;
- if (aHandlerApp instanceof Components.interfaces.nsIWebContentHandlerInfo)
+ if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo)
return aHandlerApp.uri;
return false;
},
_isValidHandlerExecutable: function(aExecutable) {
let isExecutable = aExecutable &&
aExecutable.exists() &&
@@ -1302,35 +1300,35 @@ var gApplicationsPane = {
askMenuItem.setAttribute("tooltiptext", label);
askMenuItem.setAttribute(APP_ICON_ATTR_NAME, "ask");
menuPopup.appendChild(askMenuItem);
}
// Create a menu item for saving to disk.
// Note: this option isn't available to protocol types, since we don't know
// what it means to save a URL having a certain scheme to disk.
- if ((handlerInfo.wrappedHandlerInfo instanceof Components.interfaces.nsIMIMEInfo)) {
+ if ((handlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo)) {
var saveMenuItem = document.createElement("menuitem");
- saveMenuItem.setAttribute("action", Components.interfaces.nsIHandlerInfo.saveToDisk);
+ saveMenuItem.setAttribute("action", Ci.nsIHandlerInfo.saveToDisk);
let label = this._prefsBundle.getString("saveFile");
saveMenuItem.setAttribute("label", label);
saveMenuItem.setAttribute("tooltiptext", label);
saveMenuItem.setAttribute(APP_ICON_ATTR_NAME, "save");
menuPopup.appendChild(saveMenuItem);
}
// Add a separator to distinguish these items from the helper app items
// that follow them.
let menuItem = document.createElement("menuseparator");
menuPopup.appendChild(menuItem);
// Create a menu item for the OS default application, if any.
if (handlerInfo.hasDefaultHandler) {
var defaultMenuItem = document.createElement("menuitem");
- defaultMenuItem.setAttribute("action", Components.interfaces.nsIHandlerInfo.useSystemDefault);
+ defaultMenuItem.setAttribute("action", Ci.nsIHandlerInfo.useSystemDefault);
let label = this._prefsBundle.getFormattedString("useDefault",
[handlerInfo.defaultDescription]);
defaultMenuItem.setAttribute("label", label);
defaultMenuItem.setAttribute("tooltiptext", handlerInfo.defaultDescription);
defaultMenuItem.setAttribute("image", this._getIconURLForSystemDefault(handlerInfo));
menuPopup.appendChild(defaultMenuItem);
}
@@ -1340,19 +1338,19 @@ var gApplicationsPane = {
let possibleApps = handlerInfo.possibleApplicationHandlers.enumerate();
var possibleAppMenuItems = [];
while (possibleApps.hasMoreElements()) {
let possibleApp = possibleApps.getNext();
if (!this.isValidHandlerApp(possibleApp))
continue;
let menuItem = document.createElement("menuitem");
- menuItem.setAttribute("action", Components.interfaces.nsIHandlerInfo.useHelperApp);
+ menuItem.setAttribute("action", Ci.nsIHandlerInfo.useHelperApp);
let label;
- if (possibleApp instanceof Components.interfaces.nsILocalHandlerApp)
+ if (possibleApp instanceof Ci.nsILocalHandlerApp)
label = getDisplayNameForFile(possibleApp.executable);
else
label = possibleApp.name;
label = this._prefsBundle.getFormattedString("useApp", [label]);
menuItem.setAttribute("label", label);
menuItem.setAttribute("tooltiptext", label);
menuItem.setAttribute("image", this._getIconURLForHandlerApp(possibleApp));
@@ -1377,19 +1375,19 @@ var gApplicationsPane = {
menuPopup.appendChild(pluginMenuItem);
}
// Create a menu item for selecting a local application.
let createItem = true;
if (AppConstants.platform == "win") {
// On Windows, selecting an application to open another application
// would be meaningless so we special case executables.
- var executableType = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService)
- .getTypeFromExtension("exe");
+ var executableType = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService)
+ .getTypeFromExtension("exe");
if (handlerInfo.type == executableType)
createItem = false;
}
if (createItem)
{
let menuItem = document.createElement("menuitem");
menuItem.setAttribute("oncommand", "gApplicationsPane.chooseApp(event)");
@@ -1418,31 +1416,31 @@ var gApplicationsPane = {
// Select the item corresponding to the preferred action. If the always
// ask flag is set, it overrides the preferred action. Otherwise we pick
// the item identified by the preferred action (when the preferred action
// is to use a helper app, we have to pick the specific helper app item).
if (handlerInfo.alwaysAskBeforeHandling)
menu.selectedItem = askMenuItem;
else switch (handlerInfo.preferredAction) {
- case Components.interfaces.nsIHandlerInfo.handleInternally:
+ case Ci.nsIHandlerInfo.handleInternally:
menu.selectedItem = internalMenuItem;
break;
- case Components.interfaces.nsIHandlerInfo.useSystemDefault:
+ case Ci.nsIHandlerInfo.useSystemDefault:
menu.selectedItem = defaultMenuItem;
break;
- case Components.interfaces.nsIHandlerInfo.useHelperApp:
+ case Ci.nsIHandlerInfo.useHelperApp:
if (preferredApp)
menu.selectedItem =
possibleAppMenuItems.filter(v => v.handlerApp.equals(preferredApp))[0];
break;
case kActionUsePlugin:
menu.selectedItem = pluginMenuItem;
break;
- case Components.interfaces.nsIHandlerInfo.saveToDisk:
+ case Ci.nsIHandlerInfo.saveToDisk:
menu.selectedItem = saveMenuItem;
break;
}
// menu.selectedItem may be null if the preferredAction is
// useSystemDefault, but handlerInfo.hasDefaultHandler returns false.
// For now, we'll just use the askMenuItem to avoid ugly exceptions.
menu.previousSelectedItem = menu.selectedItem || askMenuItem;
},
@@ -1548,17 +1546,17 @@ var gApplicationsPane = {
handlerInfo.disablePluginType();
// Set the preferred application handler.
// We leave the existing preferred app in the list when we set
// the preferred action to something other than useHelperApp so that
// legacy datastores that don't have the preferred app in the list
// of possible apps still include the preferred app in the list of apps
// the user can choose to handle the type.
- if (action == Components.interfaces.nsIHandlerInfo.useHelperApp)
+ if (action == Ci.nsIHandlerInfo.useHelperApp)
handlerInfo.preferredApplicationHandler = aActionItem.handlerApp;
// Set the "always ask" flag.
handlerInfo.alwaysAskBeforeHandling = false;
// Set the preferred action.
handlerInfo.preferredAction = action;
}
@@ -1663,30 +1661,30 @@ var gApplicationsPane = {
params.handlerApp.executable.isFile()) {
handlerApp = params.handlerApp;
// Add the app to the type's list of possible handlers.
handlerInfo.addPossibleApplicationHandler(handlerApp);
}
onSelectionDone();
} else {
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- let fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ let fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
let winTitle = this._prefsBundle.getString("fpTitleChooseApp");
fp.init(window, winTitle, nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterApps);
// Prompt the user to pick an app. If they pick one, and it's a valid
// selection, then add it to the list of possible handlers.
fp.open(rv => {
if (rv == nsIFilePicker.returnOK && fp.file &&
this._isValidHandlerExecutable(fp.file)) {
- handlerApp = Components.classes["@mozilla.org/uriloader/local-handler-app;1"]
- .createInstance(Components.interfaces.nsILocalHandlerApp);
+ handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"]
+ .createInstance(Ci.nsILocalHandlerApp);
handlerApp.name = getDisplayNameForFile(fp.file);
handlerApp.executable = fp.file;
// Add the app to the type's list of possible handlers.
let handlerInfo = this._handledTypes[this._list.selectedItem.type];
handlerInfo.addPossibleApplicationHandler(handlerApp);
}
onSelectionDone();
@@ -1741,63 +1739,63 @@ var gApplicationsPane = {
aElement.removeAttribute("actionIcon");
if (aHandlerInfo.alwaysAskBeforeHandling) {
aElement.setAttribute(APP_ICON_ATTR_NAME, "ask");
return true;
}
switch (aHandlerInfo.preferredAction) {
- case Components.interfaces.nsIHandlerInfo.saveToDisk:
+ case Ci.nsIHandlerInfo.saveToDisk:
aElement.setAttribute(APP_ICON_ATTR_NAME, "save");
return true;
- case Components.interfaces.nsIHandlerInfo.handleInternally:
+ case Ci.nsIHandlerInfo.handleInternally:
break;
case kActionUsePlugin:
aElement.setAttribute(APP_ICON_ATTR_NAME, "plugin");
return true;
}
aElement.removeAttribute(APP_ICON_ATTR_NAME);
return false;
},
_getIconURLForPreferredAction: function(aHandlerInfo) {
switch (aHandlerInfo.preferredAction) {
- case Components.interfaces.nsIHandlerInfo.useSystemDefault:
+ case Ci.nsIHandlerInfo.useSystemDefault:
return this._getIconURLForSystemDefault(aHandlerInfo);
- case Components.interfaces.nsIHandlerInfo.useHelperApp:
+ case Ci.nsIHandlerInfo.useHelperApp:
let preferredApp = aHandlerInfo.preferredApplicationHandler;
if (this.isValidHandlerApp(preferredApp))
return this._getIconURLForHandlerApp(preferredApp);
}
// This should never happen, but if preferredAction is set to some weird
// value, then fall back to the generic application icon.
return ICON_URL_APP;
},
_getIconURLForHandlerApp: function(aHandlerApp) {
- if (aHandlerApp instanceof Components.interfaces.nsILocalHandlerApp)
+ if (aHandlerApp instanceof Ci.nsILocalHandlerApp)
return this._getIconURLForFile(aHandlerApp.executable);
- if (aHandlerApp instanceof Components.interfaces.nsIWebHandlerApp)
+ if (aHandlerApp instanceof Ci.nsIWebHandlerApp)
return this._getIconURLForWebApp(aHandlerApp.uriTemplate);
- if (aHandlerApp instanceof Components.interfaces.nsIWebContentHandlerInfo)
+ if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo)
return this._getIconURLForWebApp(aHandlerApp.uri)
// We know nothing about other kinds of handler apps.
return "";
},
_getIconURLForFile: function(aFile) {
let urlSpec = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler)
+ .QueryInterface(Ci.nsIFileProtocolHandler)
.getURLSpecFromFile(aFile);
return "moz-icon://" + urlSpec + "?size=16";
},
_getIconURLForWebApp: function(aWebAppURITemplate) {
var uri = Services.io.newURI(aWebAppURITemplate);
@@ -1816,18 +1814,18 @@ var gApplicationsPane = {
_getIconURLForSystemDefault: function(aHandlerInfo) {
// Handler info objects for MIME types on some OSes implement a property bag
// interface from which we can get an icon for the default app, so if we're
// dealing with a MIME type on one of those OSes, then try to get the icon.
if ("wrappedHandlerInfo" in aHandlerInfo) {
let wrappedHandlerInfo = aHandlerInfo.wrappedHandlerInfo;
- if (wrappedHandlerInfo instanceof Components.interfaces.nsIMIMEInfo &&
- wrappedHandlerInfo instanceof Components.interfaces.nsIPropertyBag) {
+ if (wrappedHandlerInfo instanceof Ci.nsIMIMEInfo &&
+ wrappedHandlerInfo instanceof Ci.nsIPropertyBag) {
try {
let url = wrappedHandlerInfo.getProperty("defaultApplicationIconURL");
if (url)
return url + "?size=16";
}
catch(ex) { }
}
}
--- a/mail/components/preferences/attachmentReminder.js
+++ b/mail/components/preferences/attachmentReminder.js
@@ -15,17 +15,17 @@ var gAttachmentReminderOptionsDialog = {
this.bundle = document.getElementById("bundlePreferences");
this.buildKeywordList();
},
buildKeywordList: function()
{
var keywordsInCsv = Services.prefs
.getComplexValue("mail.compose.attachment_reminder_keywords",
- Components.interfaces.nsIPrefLocalizedString);
+ Ci.nsIPrefLocalizedString);
if (!keywordsInCsv)
return;
var keywordsInCsv = keywordsInCsv.data;
var keywordsInArr = keywordsInCsv.split(",");
for (var i = 0; i < keywordsInArr.length; i++)
{
if (keywordsInArr[i])
this.keywordListBox.appendItem(keywordsInArr[i], keywordsInArr[i]);
--- a/mail/components/preferences/compose.js
+++ b/mail/components/preferences/compose.js
@@ -146,17 +146,17 @@ var gComposePane = {
// Set pref that there's no default startup view directory any more.
Services.prefs.setBoolPref("mail.addr_book.view.startupURIisDefault", false);
}
},
initLanguageMenu: function ()
{
var languageMenuList = document.getElementById("languageMenuList");
- this.mSpellChecker = Components.classes['@mozilla.org/spellchecker/engine;1'].getService(Components.interfaces.mozISpellCheckingEngine);
+ this.mSpellChecker = Cc['@mozilla.org/spellchecker/engine;1'].getService(Ci.mozISpellCheckingEngine);
var o1 = {};
var o2 = {};
// Get the list of dictionaries from
// the spellchecker.
this.mSpellChecker.getDictionaryList(o1, o2);
@@ -186,18 +186,18 @@ var gComposePane = {
languageMenuList.setInitialSelection();
},
populateFonts: function()
{
var fontsList = document.getElementById("FontSelect");
try
{
- var enumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
- .getService(Components.interfaces.nsIFontEnumerator);
+ var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
+ .getService(Ci.nsIFontEnumerator);
var localFontCount = { value: 0 }
var localFonts = enumerator.EnumerateAllFonts(localFontCount);
for (var i = 0; i < localFonts.length; ++i)
{
// Remove Linux system generic fonts that collide with CSS generic fonts.
if (localFonts[i] != "" && localFonts[i] != "serif" &&
localFonts[i] != "sans-serif" && localFonts[i] != "monospace")
fontsList.appendItem(localFonts[i], localFonts[i]);
--- a/mail/components/preferences/connection.js
+++ b/mail/components/preferences/connection.js
@@ -139,17 +139,17 @@ var gConnectionsDialog = {
}
var backupPref = document.getElementById("network.proxy.backup." + aProtocol + (aIsPort ? "_port" : ""));
return backupPref.hasUserValue ? backupPref.value : undefined;
},
reloadPAC: function ()
{
- Components.classes["@mozilla.org/network/protocol-proxy-service;1"].
+ Cc["@mozilla.org/network/protocol-proxy-service;1"].
getService().reloadPAC();
},
doAutoconfigURLFixup: function ()
{
var autoURL = document.getElementById("networkProxyAutoconfigURL");
var autoURLPref = document.getElementById("network.proxy.autoconfig_url");
try {
--- a/mail/components/preferences/cookies.js
+++ b/mail/components/preferences/cookies.js
@@ -1,17 +1,17 @@
/* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
-var nsICookie = Components.interfaces.nsICookie;
+var nsICookie = Ci.nsICookie;
var gCookiesWindow = {
_hosts : {},
_hostOrder : [],
_tree : null,
_bundle : null,
init: function ()
@@ -70,17 +70,17 @@ var gCookiesWindow = {
aCookieB.originAttributes);
},
observe: function (aCookie, aTopic, aData)
{
if (aTopic != "cookie-changed")
return;
- if (aCookie instanceof Components.interfaces.nsICookie) {
+ if (aCookie instanceof Ci.nsICookie) {
var strippedHost = this._makeStrippedHost(aCookie.host);
if (aData == "changed")
this._handleCookieChanged(aCookie, strippedHost);
else if (aData == "added")
this._handleCookieAdded(aCookie, strippedHost);
}
else if (aData == "cleared") {
this._hosts = {};
@@ -496,17 +496,17 @@ var gCookiesWindow = {
_loadCookies: function ()
{
var e = Services.cookies.enumerator;
var hostCount = { value: 0 };
this._hosts = {};
this._hostOrder = [];
while (e.hasMoreElements()) {
var cookie = e.getNext();
- if (cookie && cookie instanceof Components.interfaces.nsICookie) {
+ if (cookie && cookie instanceof Ci.nsICookie) {
var strippedHost = this._makeStrippedHost(cookie.host);
this._addCookie(strippedHost, cookie, hostCount);
}
else
break;
}
this._view._rowCount = hostCount.value;
},
--- a/mail/components/preferences/display.js
+++ b/mail/components/preferences/display.js
@@ -109,17 +109,17 @@ var gDisplayPane = {
}
}
},
_safelySelectDefaultLanguageGroup(aLanguageGroup) {
var isSerif = this._readDefaultFontTypeForLanguage(aLanguageGroup) == "serif";
this._selectDefaultLanguageGroupPromise =
this._selectDefaultLanguageGroup(aLanguageGroup, isSerif)
- .catch(Components.utils.reportError);
+ .catch(Cu.reportError);
},
/**
* Returns the type of the current default font for the language denoted by
* aLanguageGroup.
*/
_readDefaultFontTypeForLanguage: function (aLanguageGroup)
{
--- a/mail/components/preferences/downloads.js
+++ b/mail/components/preferences/downloads.js
@@ -1,24 +1,24 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gDownloadDirSection = {
chooseFolder: function ()
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
var bundlePreferences = document.getElementById("bundlePreferences");
var title = bundlePreferences.getString("chooseAttachmentsFolderTitle");
fp.init(window, title, nsIFilePicker.modeGetFolder);
- const nsIFile = Components.interfaces.nsIFile;
+ const nsIFile = Ci.nsIFile;
var customDirPref = document.getElementById("browser.download.dir");
if (customDirPref.value)
fp.displayDirectory = customDirPref.value;
fp.appendFilters(nsIFilePicker.filterAll);
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.file) {
return;
}
@@ -77,17 +77,17 @@ var gDownloadDirSection = {
return "UsrDocs";
return "Home";
},
_getDownloadsFolder: function (aFolder)
{
let dir = Services.dirsvc.get(this._getSpecialFolderKey(aFolder),
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
if (aFolder != "Desktop")
dir.append("My Downloads");
return dir;
},
readDownloadDirPref: function ()
{
@@ -102,17 +102,17 @@ var gDownloadDirSection = {
else if (folderListPref.value == 1 || customIndex == 1)
downloadFolder.label = bundlePreferences.getString("myDownloadsFolderName");
else
downloadFolder.label = customDirPref.value ? customDirPref.value.path : "";
var currentDirPref = document.getElementById("browser.download.downloadDir");
var downloadDir = currentDirPref.value || this._indexToFile(folderListPref.value);
let urlSpec = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler)
+ .QueryInterface(Ci.nsIFileProtocolHandler)
.getURLSpecFromFile(downloadDir);
downloadFolder.image = "moz-icon://" + urlSpec + "?size=16";
return undefined;
},
writeFolderList: function ()
--- a/mail/components/preferences/fonts.js
+++ b/mail/components/preferences/fonts.js
@@ -64,17 +64,17 @@ var gFontsDialog = {
preference.setElementValue(element);
}
}
},
_safelySelectLanguageGroup(aLanguageGroup) {
this._selectLanguageGroupPromise =
this._selectLanguageGroup(aLanguageGroup)
- .catch(Components.utils.reportError);
+ .catch(Cu.reportError);
},
readFontLanguageGroup: function ()
{
var languagePref = document.getElementById("font.language.group");
this._safelySelectLanguageGroup(languagePref.value);
return undefined;
},
--- a/mail/components/preferences/general.js
+++ b/mail/components/preferences/general.js
@@ -76,17 +76,17 @@ var gGeneralPane = {
convertURLToLocalFile: function(aFileURL)
{
// convert the file url into a nsIFile
if (aFileURL)
{
return Services.io
.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler)
+ .QueryInterface(Ci.nsIFileProtocolHandler)
.getFileFromURLSpec(aFileURL);
}
else
return null;
},
readSoundLocation: function()
{
@@ -97,39 +97,39 @@ var gGeneralPane = {
soundUrlLocation.label = this.convertURLToLocalFile(soundUrlLocation.value).leafName;
soundUrlLocation.image = "moz-icon://" + soundUrlLocation.label + "?size=16";
}
return undefined;
},
previewSound: function ()
{
- let sound = Components.classes["@mozilla.org/sound;1"]
- .createInstance(Components.interfaces.nsISound);
+ let sound = Cc["@mozilla.org/sound;1"]
+ .createInstance(Ci.nsISound);
let soundLocation;
// soundType radio-group isn't used for macOS so it is not in the XUL file
// for the platform.
soundLocation = (AppConstants.platform == "macosx" ||
document.getElementById('soundType').value == 1) ?
document.getElementById('soundUrlLocation').value : "";
if (!soundLocation.includes("file://")) {
// User has not set any custom sound file to be played
- sound.playEventSound(Components.interfaces.nsISound.EVENT_NEW_MAIL_RECEIVED);
+ sound.playEventSound(Ci.nsISound.EVENT_NEW_MAIL_RECEIVED);
} else {
// User has set a custom audio file to be played along the alert.
sound.play(Services.io.newURI(soundLocation));
}
},
browseForSoundFile: function ()
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
// if we already have a sound file, then use the path for that sound file
// as the initial path in the dialog.
var localFile = this.convertURLToLocalFile(document.getElementById('soundUrlLocation').value);
if (localFile)
fp.displayDirectory = localFile.parent;
// XXX todo, persist the last sound directory and pass it in
--- a/mail/components/preferences/permissions.js
+++ b/mail/components/preferences/permissions.js
@@ -1,17 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
-var nsIPermissionManager = Components.interfaces.nsIPermissionManager;
-var nsICookiePermission = Components.interfaces.nsICookiePermission;
+var nsIPermissionManager = Ci.nsIPermissionManager;
+var nsICookiePermission = Ci.nsICookiePermission;
var NOTIFICATION_FLUSH_PERMISSIONS = "flush-pending-permissions";
/**
* Magic URI base used so the permission manager can store
* remote content permissions for a given email address.
*/
var MAILURI_BASE = "chrome://messenger/content/email=";
@@ -288,17 +288,17 @@ var gPermissionManager = {
this._observerRemoved = true;
}
},
observe: function (aSubject, aTopic, aData)
{
if (aTopic == "perm-changed") {
- var permission = aSubject.QueryInterface(Components.interfaces.nsIPermission);
+ var permission = aSubject.QueryInterface(Ci.nsIPermission);
// Ignore unrelated permission types.
if (permission.type != this._type)
return;
if (aData == "added") {
this._addPermission(permission);
}
@@ -403,17 +403,17 @@ var gPermissionManager = {
{
this._tree = document.getElementById("permissionsTree");
this._permissions = [];
// load permissions into a table
var count = 0;
var enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
- var nextPermission = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
+ var nextPermission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
this._addPermissionToList(nextPermission);
}
this._view._rowCount = this._permissions.length;
// sort and display the table
this._tree.view = this._view;
this.onPermissionSort("origin");
--- a/mail/components/preferences/preferencesTab.js
+++ b/mail/components/preferences/preferencesTab.js
@@ -13,18 +13,18 @@ var gPrefTab = null;
*/
var preferencesTabType = {
__proto__: contentTabBaseType,
name: "preferencesTab",
perTabPanel: "vbox",
lastBrowserId: 0,
bundle: Services.strings.createBundle(
"chrome://messenger/locale/messenger.properties"),
- protoSvc: Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService),
+ protoSvc: Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService),
get loadingTabString() {
delete this.loadingTabString;
return this.loadingTabString = document.getElementById("bundle_messenger")
.getString("loadingTab");
},
modes: {
--- a/mail/components/preferences/subdialogs.js
+++ b/mail/components/preferences/subdialogs.js
@@ -119,17 +119,17 @@ SubDialog.prototype = {
this._closingPromise = new Promise(resolve => {
this._resolveClosePromise = resolve;
});
if (this._closingCallback) {
try {
this._closingCallback.call(null, aEvent);
} catch (ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
this._closingCallback = null;
}
Services.prefs.setBoolPref("browser.preferences.instantApply", this._instantApplyOrig);
this._removeDialogEventListeners();
this._overlay.style.visibility = "";
@@ -303,17 +303,17 @@ SubDialog.prototype = {
// Do this with a frame height in pixels...
let comparisonFrameHeight;
if (frameHeight.endsWith("em")) {
let fontSize = parseFloat(getComputedStyle(this._frame).fontSize);
comparisonFrameHeight = parseFloat(frameHeight, 10) * fontSize;
} else if (frameHeight.endsWith("px")) {
comparisonFrameHeight = parseFloat(frameHeight, 10);
} else {
- Components.utils.reportError(
+ Cu.reportError(
"This dialog (" + this._frame.contentWindow.location.href + ") " +
"set a height in non-px-non-em units ('" + frameHeight + "'), " +
"which is likely to lead to bad sizing in in-content preferences. " +
"Please consider changing this.");
comparisonFrameHeight = parseFloat(frameHeight);
}
if (comparisonFrameHeight > maxHeight) {
@@ -480,19 +480,19 @@ SubDialog.prototype = {
_untrapFocus() {
this._frame.contentDocument.removeEventListener("keydown", this, true);
this._closeButton.removeEventListener("keydown", this);
window.removeEventListener("focus", this);
},
_getBrowser() {
- return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
+ return window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
},
};
var gSubDialog = {
/**
* New dialogs are stacked on top of the existing ones, and they are pushed
* to the end of the _dialogs array.
--- a/mail/components/search/content/searchCommon.js
+++ b/mail/components/search/content/searchCommon.js
@@ -790,17 +790,17 @@ var SearchSupport =
/// Reindex time for this message header
_reindexTime: null,
QueryInterface: function(aIId, instance) {
if (aIId.equals(Ci.nsIStreamListener) || aIId.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
/// "Finish" function, cleans up behind itself if unsuccessful
_onDoneStreaming: function search_on_done_streaming(successful)
{
this._outputStream = null;
if (!successful && this._msgHdr)
{
--- a/mail/extensions/mailviews/content/mailViewList.js
+++ b/mail/extensions/mailviews/content/mailViewList.js
@@ -7,17 +7,17 @@ ChromeUtils.import("resource://gre/modul
var gMailListView;
var gListBox;
var gEditButton;
var gDeleteButton;
function mailViewListOnLoad()
{
- gMailListView = Components.classes["@mozilla.org/messenger/mailviewlist;1"].getService(Components.interfaces.nsIMsgMailViewList);;
+ gMailListView = Cc["@mozilla.org/messenger/mailviewlist;1"].getService(Ci.nsIMsgMailViewList);;
gListBox = document.getElementById('mailViewList');
// Construct list view based on current mail view list data
refreshListView(null);
gEditButton = document.getElementById('editButton');
gDeleteButton = document.getElementById('deleteButton');
updateButtons();
--- a/mail/extensions/mailviews/content/mailViewSetup.js
+++ b/mail/extensions/mailviews/content/mailViewSetup.js
@@ -1,14 +1,14 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
+var nsMsgSearchScope = Ci.nsMsgSearchScope;
var gMailView = null;
var dialog;
function mailViewOnLoad()
{
initializeSearchWidgets();
initializeMailViewOverrides();
@@ -42,17 +42,17 @@ function mailViewOnLoad()
function mailViewOnUnLoad()
{
}
function onOK()
{
- var mailViewList = Components.classes["@mozilla.org/messenger/mailviewlist;1"].getService(Components.interfaces.nsIMsgMailViewList);
+ var mailViewList = Cc["@mozilla.org/messenger/mailviewlist;1"].getService(Ci.nsIMsgMailViewList);
// reflect the search widgets back into the search session
var newMailView = null;
if (gMailView)
{
saveSearchTerms(gMailView.searchTerms, gMailView);
// if the name of the view has been changed...
if (gMailView.prettyName != dialog.nameField.value)
--- a/mail/extensions/mailviews/content/msgViewPickerOverlay.js
+++ b/mail/extensions/mailviews/content/msgViewPickerOverlay.js
@@ -21,21 +21,21 @@ var kViewCurrent = MailViewConstants.
var kViewCurrentTag = MailViewConstants.kViewCurrentTag;
var kViewTagMarker = MailViewConstants.kViewTagMarker;
/**
* A reference to the nsIMsgMailViewList service that tracks custom mail views.
*/
var gMailViewList = null;
-var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
-var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
-var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
+var nsMsgSearchScope = Ci.nsMsgSearchScope;
+var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
+var nsMsgSearchOp = Ci.nsMsgSearchOp;
-var nsMsgMessageFlags = Components.interfaces.nsMsgMessageFlags;
+var nsMsgMessageFlags = Ci.nsMsgMessageFlags;
// perform the view/action requested by the aValue string
// and set the view picker label to the aLabel string
function ViewChange(aValue)
{
if (aValue == kViewItemCustomize || aValue == kViewItemVirtual)
{
// restore to the previous view value, in case they cancel
@@ -182,32 +182,32 @@ function RefreshViewPopup(aViewPopup)
// only show the "Not Deleted" item for IMAP servers that are using the IMAP
// delete model
viewNotDeleted.setAttribute("hidden", true);
var msgFolder = folderArray[0];
var server = msgFolder.server;
if (server.type == "imap")
{
let imapServer =
- server.QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ server.QueryInterface(Ci.nsIImapIncomingServer);
if (imapServer.deleteModel == 0) { // nsMsgImapDeleteModels.IMAPDelete
viewNotDeleted.setAttribute("hidden", false);
viewNotDeleted.setAttribute("checked",
currentViewValue == kViewItemNotDeleted);
}
}
}
function RefreshCustomViewsPopup(aMenupopup)
{
// for each mail view in the msg view list, add an entry in our combo box
if (!gMailViewList)
- gMailViewList = Components.classes["@mozilla.org/messenger/mailviewlist;1"]
- .getService(Components.interfaces.nsIMsgMailViewList);
+ gMailViewList = Cc["@mozilla.org/messenger/mailviewlist;1"]
+ .getService(Ci.nsIMsgMailViewList);
// remove all menuitems
while (aMenupopup.hasChildNodes())
aMenupopup.lastChild.remove();
// now rebuild the list
var currentView = ViewPickerBinding.currentViewValue;
var numItems = gMailViewList.mailViewCount;
for (var i = 0; i < numItems; ++i)
--- a/mail/extensions/smime/content/msgCompSMIMEOverlay.js
+++ b/mail/extensions/smime/content/msgCompSMIMEOverlay.js
@@ -8,35 +8,35 @@ ChromeUtils.import("resource:///modules/
// Account encryption policy values:
// const kEncryptionPolicy_Never = 0;
// 'IfPossible' was used by ns4.
// const kEncryptionPolicy_IfPossible = 1;
var kEncryptionPolicy_Always = 2;
var gEncryptedURIService =
- Components.classes["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
- .getService(Components.interfaces.nsIEncryptedSMIMEURIsService);
+ Cc["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
+ .getService(Ci.nsIEncryptedSMIMEURIsService);
var gNextSecurityButtonCommand = "";
var gSMFields = null;
var gEncryptOptionChanged;
var gSignOptionChanged;
function onComposerLoad()
{
// Are we already set up ? Or are the required fields missing ?
if (gSMFields || !gMsgCompose || !gMsgCompose.compFields)
return;
gMsgCompose.compFields.securityInfo = null;
- gSMFields = Components.classes["@mozilla.org/messenger-smime/composefields;1"]
- .createInstance(Components.interfaces.nsIMsgSMIMECompFields);
+ gSMFields = Cc["@mozilla.org/messenger-smime/composefields;1"]
+ .createInstance(Ci.nsIMsgSMIMECompFields);
if (!gSMFields)
return;
gMsgCompose.compFields.securityInfo = gSMFields;
// Set up the intial security state.
gSMFields.requireEncryptMessage =
gCurrentIdentity.getIntAttribute("encryptionpolicy") == kEncryptionPolicy_Always;
@@ -80,17 +80,17 @@ function smimeComposeOnUnload()
removeEventListener("compose-send-message", onComposerSendMessage, true);
top.controllers.removeController(SecurityController);
}
function GetServer()
{
let servers = MailServices.accounts.getServersForIdentity(gCurrentIdentity);
- return servers.queryElementAt(0, Components.interfaces.nsIMsgIncomingServer);
+ return servers.queryElementAt(0, Ci.nsIMsgIncomingServer);
}
function showNeedSetupInfo()
{
let compSmimeBundle = document.getElementById("bundle_comp_smime");
let brandBundle = document.getElementById("bundle_brand");
if (!compSmimeBundle || !brandBundle)
return;
@@ -271,19 +271,19 @@ function onComposerSendMessage()
let missingCount = new Object();
let emailAddresses = new Object();
try
{
if (!gMsgCompose.compFields.securityInfo.requireEncryptMessage)
return;
- Components.classes["@mozilla.org/messenger-smime/smimejshelper;1"]
- .createInstance(Components.interfaces.nsISMimeJSHelper)
- .getNoCertAddresses(gMsgCompose.compFields,
+ Cc["@mozilla.org/messenger-smime/smimejshelper;1"]
+ .createInstance(Ci.nsISMimeJSHelper)
+ .getNoCertAddresses(gMsgCompose.compFields,
missingCount,
emailAddresses);
}
catch (e)
{
return;
}
--- a/mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js
+++ b/mail/extensions/smime/content/msgHdrViewSMIMEOverlay.js
@@ -10,17 +10,17 @@ var gStatusBar = null;
var gEncryptedURIService = null;
var gMyLastEncryptedURI = null;
var gSMIMEBundle = null;
// manipulates some globals from msgReadSMIMEOverlay.js
-var nsICMSMessageErrors = Components.interfaces.nsICMSMessageErrors;
+var nsICMSMessageErrors = Ci.nsICMSMessageErrors;
var smimeHeaderSink =
{
maxWantedNesting: function()
{
return 1;
},
@@ -144,19 +144,19 @@ var smimeHeaderSink =
body+"\n"+
"</td></tr></table></center></body></html>", false);
break;
}
},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIMsgSMIMEHeaderSink) || iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIMsgSMIMEHeaderSink) || iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
};
function forgetEncryptedURI()
{
if (gMyLastEncryptedURI && gEncryptedURIService)
{
gEncryptedURIService.forgetEncrypted(gMyLastEncryptedURI);
@@ -228,18 +228,18 @@ function msgHdrViewSMIMEOnLoad(event)
// when we are about to display a message.
var listener = {};
listener.onStartHeaders = onSMIMEStartHeaders;
listener.onEndHeaders = onSMIMEEndHeaders;
listener.onBeforeShowHeaderPane = onSMIMEBeforeShowHeaderPane;
gMessageListeners.push(listener);
gEncryptedURIService =
- Components.classes["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
- .getService(Components.interfaces.nsIEncryptedSMIMEURIsService);
+ Cc["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
+ .getService(Ci.nsIEncryptedSMIMEURIsService);
}
function msgHdrViewSMIMEOnUnload(event)
{
window.crypto.enableSmartCardEvents = false;
document.removeEventListener("smartcard-insert", onSmartCardChange);
document.removeEventListener("smartcard-remove", onSmartCardChange);
forgetEncryptedURI();
--- a/mail/test/mozmill/account/test-account-actions.js
+++ b/mail/test/mozmill/account/test-account-actions.js
@@ -19,29 +19,29 @@ function setupModule(module) {
originalAccountCount = MailServices.accounts.allServers.length;
// There already should be a Local Folders account created.
// It is needed for this test.
assert_true(MailServices.accounts.localFoldersServer);
// Create an IMAP server
let imapServer = MailServices.accounts
.createIncomingServer("nobody", "example.com", "imap")
- .QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ .QueryInterface(Ci.nsIImapIncomingServer);
let identity = MailServices.accounts.createIdentity();
identity.email = "tinderbox@example.com";
imapAccount = MailServices.accounts.createAccount();
imapAccount.incomingServer = imapServer;
imapAccount.addIdentity(identity);
// Create a NNTP server
let nntpServer = MailServices.accounts
.createIncomingServer(null, "example.nntp.invalid", "nntp")
- .QueryInterface(Components.interfaces.nsINntpIncomingServer);
+ .QueryInterface(Ci.nsINntpIncomingServer);
identity = MailServices.accounts.createIdentity();
identity.email = "tinderbox2@example.com";
nntpAccount = MailServices.accounts.createAccount();
nntpAccount.incomingServer = nntpServer;
nntpAccount.addIdentity(identity);
// Now there should be 2 more accounts.
--- a/mail/test/mozmill/account/test-account-settings-infrastructure.js
+++ b/mail/test/mozmill/account/test-account-settings-infrastructure.js
@@ -27,29 +27,29 @@ function setupModule(module) {
collector.getModule("account-manager-helpers").installInto(module);
// There may be pre-existing accounts from other tests.
gOriginalAccountCount = MailServices.accounts.allServers.length;
// Create a POP server
let popServer = MailServices.accounts
.createIncomingServer("nobody", "pop.invalid", "pop3")
- .QueryInterface(Components.interfaces.nsIPop3IncomingServer);
+ .QueryInterface(Ci.nsIPop3IncomingServer);
let identity = MailServices.accounts.createIdentity();
identity.email = "tinderbox@pop.invalid";
gPopAccount = MailServices.accounts.createAccount();
gPopAccount.incomingServer = popServer;
gPopAccount.addIdentity(identity);
// Create an IMAP server
let imapServer = MailServices.accounts
.createIncomingServer("nobody", "imap.invalid", "imap")
- .QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ .QueryInterface(Ci.nsIImapIncomingServer);
identity = MailServices.accounts.createIdentity();
identity.email = "tinderbox@imap.invalid";
gImapAccount = MailServices.accounts.createAccount();
gImapAccount.incomingServer = imapServer;
gImapAccount.addIdentity(identity);
--- a/mail/test/mozmill/account/test-account-values.js
+++ b/mail/test/mozmill/account/test-account-values.js
@@ -24,17 +24,17 @@ function setupModule(module) {
collector.getModule("account-manager-helpers").installInto(module);
// There may be pre-existing accounts from other tests.
gOriginalAccountCount = MailServices.accounts.allServers.length;
// Create a POP server
let popServer = MailServices.accounts
.createIncomingServer("nobody", "example.invalid", "pop3")
- .QueryInterface(Components.interfaces.nsIPop3IncomingServer);
+ .QueryInterface(Ci.nsIPop3IncomingServer);
let identity = MailServices.accounts.createIdentity();
identity.email = "tinderbox@example.invalid";
gPopAccount = MailServices.accounts.createAccount();
gPopAccount.incomingServer = popServer;
gPopAccount.addIdentity(identity);
@@ -100,17 +100,17 @@ function subtest_check_default_CC_addres
* Check if the account name automatically changes when the user changes
* the username or hostname.
*/
function test_account_name() {
// We already have a POP account ready.
// Create also a NNTP server.
let nntpServer = MailServices.accounts
.createIncomingServer(null, "example.nntp.invalid", "nntp")
- .QueryInterface(Components.interfaces.nsINntpIncomingServer);
+ .QueryInterface(Ci.nsINntpIncomingServer);
identity = MailServices.accounts.createIdentity();
identity.email = "tinderbox2@example.invalid";
let nntpAccount = MailServices.accounts.createAccount();
nntpAccount.incomingServer = nntpServer;
nntpAccount.addIdentity(identity);
--- a/mail/test/mozmill/account/test-archive-options.js
+++ b/mail/test/mozmill/account/test-archive-options.js
@@ -45,17 +45,17 @@ function subtest_check_archive_options_e
assert_equals(button.disabled, !isEnabled);
}
function test_archive_options_enabled() {
let defaultAccount = MailServices.accounts.defaultAccount;
// First, create an IMAP server
let imapServer = MailServices.accounts
.createIncomingServer("nobody", "example.com", "imap")
- .QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ .QueryInterface(Ci.nsIImapIncomingServer);
let identity = MailServices.accounts.createIdentity();
identity.email = "tinderbox@example.com";
let account = MailServices.accounts.createAccount();
account.incomingServer = imapServer;
account.addIdentity(identity);
--- a/mail/test/mozmill/attachment/test-attachment-menus.js
+++ b/mail/test/mozmill/attachment/test-attachment-menus.js
@@ -112,18 +112,18 @@ var messages = [
function setupModule(module) {
let fdh = collector.getModule("folder-display-helpers");
fdh.installInto(module);
let wh = collector.getModule("window-helpers");
wh.installInto(module);
let ah = collector.getModule("attachment-helpers");
ah.installInto(module);
- messenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ messenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
/* Today's gory details (thanks to Jonathan Protzenko): libmime somehow
* counts the trailing newline for an attachment MIME part. Most of the time,
* assuming attachment has N bytes (no matter what's inside, newlines or
* not), libmime will return N + 1 bytes. On Linux and Mac, this always
* holds. However, on Windows, if the attachment is not encoded (that is, is
* inline text), libmime will return N + 2 bytes.
*/
--- a/mail/test/mozmill/attachment/test-attachment-size.js
+++ b/mail/test/mozmill/attachment/test-attachment-size.js
@@ -143,18 +143,18 @@ var messages = [
function setupModule(module) {
let fdh = collector.getModule('folder-display-helpers');
fdh.installInto(module);
let wh = collector.getModule('window-helpers');
wh.installInto(module);
let ah = collector.getModule('attachment-helpers');
ah.installInto(module);
- messenger = Components.classes['@mozilla.org/messenger;1']
- .createInstance(Components.interfaces.nsIMessenger);
+ messenger = Cc['@mozilla.org/messenger;1']
+ .createInstance(Ci.nsIMessenger);
/* Today's gory details (thanks to Jonathan Protzenko): libmime somehow
* counts the trailing newline for an attachment MIME part. Most of the time,
* assuming attachment has N bytes (no matter what's inside, newlines or
* not), libmime will return N + 1 bytes. On Linux and Mac, this always
* holds. However, on Windows, if the attachment is not encoded (that is, is
* inline text), libmime will return N + 2 bytes.
*/
--- a/mail/test/mozmill/cloudfile/test-cloudfile-backend-hightail.js
+++ b/mail/test/mozmill/cloudfile/test-cloudfile-backend-hightail.js
@@ -204,17 +204,17 @@ function test_create_existing_account()
gMockAuthPromptReg.register();
let provider = gServer.getPreparedBackend("someNewAccount");
let done = false;
let myObs = {
onStartRequest: function(aRequest, aContext) {
},
onStopRequest: function(aRequest, aContext, aStatusCode) {
assert_true(aContext instanceof Ci.nsIMsgCloudFileProvider);
- assert_equals(aStatusCode, Components.results.NS_OK);
+ assert_equals(aStatusCode, Cr.NS_OK);
done = true;
},
}
provider.createExistingAccount(myObs);
mc.waitFor(() => done);
gMockAuthPromptReg.unregister();
}
--- a/mail/test/mozmill/cloudfile/test-cloudfile-notifications.js
+++ b/mail/test/mozmill/cloudfile/test-cloudfile-notifications.js
@@ -261,17 +261,17 @@ function test_no_offer_on_conversion() {
let provider = new MockCloudfileAccount();
provider.init("someKey");
// Override uploadFile to succeed instantaneously so that we don't have
// to worry about waiting for the onStopRequest method being called
// asynchronously.
provider.uploadFile = function(aFile, aListener) {
aListener.onStartRequest(null, null);
- aListener.onStopRequest(null, null, Components.results.NS_OK);
+ aListener.onStopRequest(null, null, Cr.NS_OK);
};
let cw = open_compose_new_mail();
cw.window.attachToCloud(provider);
assert_cloudfile_notification_displayed(cw, false);
// Now convert the file back into a normal attachment
select_attachments(cw, 0);
cw.window.convertSelectedToRegularAttachment();
@@ -303,17 +303,17 @@ function test_offer_then_upload_notifica
let provider = new MockCloudfileAccount();
provider.init("someKey");
// Override uploadFile to succeed instantaneously so that we don't have
// to worry about waiting for the onStopRequest method being called
// asynchronously.
provider.uploadFile = function(aFile, aListener) {
aListener.onStartRequest(null, null);
- aListener.onStopRequest(null, null, Components.results.NS_OK);
+ aListener.onStopRequest(null, null, Cr.NS_OK);
};
let cw = open_compose_new_mail();
// Attach the files, saying that each is 500 bytes large - which should
// certainly trigger the offer.
add_attachments(cw, fileURIs, [500, 500]);
// Assert that the offer is displayed.
@@ -346,17 +346,17 @@ function test_privacy_warning_notificati
'./data/testFile2'], __file__);
let provider = new MockCloudfileAccount();
provider.init("aKey");
provider.uploadFile = function(aFile, aListener) {
aListener.onStartRequest(null, null);
cwc.window.setTimeout(function() {
aListener.onStopRequest(null, null,
- Components.results.NS_OK);
+ Cr.NS_OK);
}, 500);
}
let cwc = open_compose_new_mail(mc);
cwc.window.attachToCloud(provider);
assert_upload_notification_displayed(cwc, true);
wait_for_notification_to_stop(cwc, kBoxId, "bigAttachmentUploading");
@@ -387,17 +387,17 @@ function test_privacy_warning_notificati
'./data/testFile2'], __file__);
let provider = new MockCloudfileAccount();
provider.init("aKey");
provider.uploadFile = function(aFile, aListener) {
aListener.onStartRequest(null, null);
cwc.window.setTimeout(function() {
aListener.onStopRequest(null, null,
- Components.results.NS_OK);
+ Cr.NS_OK);
}, 500);
}
let cwc = open_compose_new_mail(mc);
cwc.window.attachToCloud(provider);
assert_upload_notification_displayed(cwc, true);
wait_for_notification_to_stop(cwc, kBoxId, "bigAttachmentUploading");
@@ -428,17 +428,17 @@ function test_privacy_warning_notificati
'./data/testFile2'], __file__);
let provider = new MockCloudfileAccount();
provider.init("aKey");
provider.uploadFile = function(aFile, aListener) {
aListener.onStartRequest(null, null);
cwc.window.setTimeout(function() {
aListener.onStopRequest(null, null,
- Components.results.NS_OK);
+ Cr.NS_OK);
}, 500);
}
let cwc = open_compose_new_mail(mc);
cwc.window.attachToCloud(provider);
assert_upload_notification_displayed(cwc, true);
wait_for_notification_to_stop(cwc, kBoxId, "bigAttachmentUploading");
--- a/mail/test/mozmill/composition/test-address-widgets.js
+++ b/mail/test/mozmill/composition/test-address-widgets.js
@@ -66,17 +66,17 @@ function check_nntp_address_types() {
function add_NNTP_account() {
// There may be pre-existing accounts from other tests.
originalAccountCount = MailServices.accounts.allServers.length;
// Create a NNTP server
let nntpServer = MailServices.accounts
.createIncomingServer(null, "example.nntp.invalid", "nntp")
- .QueryInterface(Components.interfaces.nsINntpIncomingServer);
+ .QueryInterface(Ci.nsINntpIncomingServer);
identity = MailServices.accounts.createIdentity();
identity.email = "tinderbox2@example.invalid";
accountNNTP = MailServices.accounts.createAccount();
accountNNTP.incomingServer = nntpServer;
accountNNTP.addIdentity(identity);
// Now there should be 1 more account.
@@ -93,17 +93,17 @@ function remove_NNTP_account() {
/**
* Bug 399446 & bug 922614
* Test that the allowed address types depend on the account type
* we are sending from.
*/
function test_address_types() {
// Be sure there is no NNTP account yet.
for (let account of fixIterator(MailServices.accounts.accounts,
- Components.interfaces.nsIMsgAccount)) {
+ Ci.nsIMsgAccount)) {
assert_not_equals(account.incomingServer.type, "nntp",
"There is a NNTP account existing unexpectedly");
}
// Open compose window on the existing POP3 account.
be_in_folder(accountPOP3.incomingServer.rootFolder);
cwc = open_compose_new_mail();
check_mail_address_types();
--- a/mail/test/mozmill/composition/test-attachment-reminder.js
+++ b/mail/test/mozmill/composition/test-attachment-reminder.js
@@ -194,17 +194,17 @@ function test_attachment_reminder_with_a
setup_msg_contents(cwc, "test@example.org", "Testing automatic reminder!",
"Hello! We will have a real attachment here.");
// Give the notification time to appear. It should.
wait_for_reminder_state(cwc, true);
// Add an attachment.
- let file = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
file.append("panacea.dat");
assert_true(file.exists(), "The required file panacea.dat was not found in the profile.");
let attachment = [cwc.window.FileToAttachment(file)];
cwc.window.AddAttachments(attachment);
// The notification should hide.
wait_for_reminder_state(cwc, false);
@@ -432,17 +432,17 @@ function test_attachment_vs_filelink_rem
"There is no body. I hope you don't mind!");
// There should be no notification yet.
assert_any_notification(cwc, false);
// Bring up the FileLink notification.
let kOfferThreshold = "mail.compose.big_attachments.threshold_kb";
let maxSize = Services.prefs.getIntPref(kOfferThreshold, 0) * 1024;
- let file = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
file.append("panacea.dat");
add_attachment(cwc, Services.io.newFileURI(file).spec, maxSize);
// The filelink attachment proposal should be up but not the attachment
// reminder and it should also not interfere with the sending of the message.
wait_for_notification_to_show(cwc, kBoxId, "bigAttachment");
assert_automatic_reminder_state(cwc, false);
--- a/mail/test/mozmill/composition/test-attachment.js
+++ b/mail/test/mozmill/composition/test-attachment.js
@@ -40,18 +40,18 @@ var b64Size = 188;
function setupModule(module) {
for (let lib of MODULE_REQUIRES) {
collector.getModule(lib).installInto(module);
}
folder = create_folder('ComposeAttachmentA');
- messenger = Components.classes['@mozilla.org/messenger;1']
- .createInstance(Components.interfaces.nsIMessenger);
+ messenger = Cc['@mozilla.org/messenger;1']
+ .createInstance(Ci.nsIMessenger);
isWindows = '@mozilla.org/windows-registry-key;1' in Components.classes;
/* Today's gory details (thanks to Jonathan Protzenko): libmime somehow
* counts the trailing newline for an attachment MIME part. Most of the time,
* assuming attachment has N bytes (no matter what's inside, newlines or
* not), libmime will return N + 1 bytes. On Linux and Mac, this always
* holds. However, on Windows, if the attachment is not encoded (that is, is
--- a/mail/test/mozmill/composition/test-blocked-content.js
+++ b/mail/test/mozmill/composition/test-blocked-content.js
@@ -32,30 +32,30 @@ var kNotificationId = "blockedContent";
function setupModule(module) {
for (let req of MODULE_REQUIRES) {
collector.getModule(req).installInto(module);
}
gOutboxFolder = get_special_folder(Ci.nsMsgFolderFlags.Queue);
}
function putHTMLOnClipboard(html) {
- let trans = Components.classes["@mozilla.org/widget/transferable;1"]
- .createInstance(Components.interfaces.nsITransferable);
+ let trans = Cc["@mozilla.org/widget/transferable;1"]
+ .createInstance(Ci.nsITransferable);
// Register supported data flavors
trans.init(null);
trans.addDataFlavor("text/html");
- let wapper = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ let wapper = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
wapper.data = html;
trans.setTransferData("text/html", wapper, wapper.data.length * 2);
Services.clipboard.setData(trans, null,
- Components.interfaces.nsIClipboard.kGlobalClipboard);
+ Ci.nsIClipboard.kGlobalClipboard);
}
/**
* Test that accessing file: URLs will block when appropriate, and load
* the content when appropriate.
*/
function test_paste_file_urls() {
let cwc = open_compose_new_mail();
--- a/mail/test/mozmill/composition/test-charset-edit.js
+++ b/mail/test/mozmill/composition/test-charset-edit.js
@@ -31,21 +31,21 @@ function setupModule(module) {
for (let req of MODULE_REQUIRES) {
collector.getModule(req).installInto(module);
}
gDrafts = get_special_folder(Ci.nsMsgFolderFlags.Drafts, true);
// Ensure reply charset isn't UTF-8, otherwise there's no need to upgrade,
// which is what this test tests.
- let str = Components.classes["@mozilla.org/pref-localizedstring;1"]
- .createInstance(Components.interfaces.nsIPrefLocalizedString);
+ let str = Cc["@mozilla.org/pref-localizedstring;1"]
+ .createInstance(Ci.nsIPrefLocalizedString);
str.data = "windows-1252";
Services.prefs.setComplexValue("mailnews.send_default_charset",
- Components.interfaces.nsIPrefLocalizedString, str);
+ Ci.nsIPrefLocalizedString, str);
}
/**
* Helper to get the full message content.
*
* @param aMsgHdr: nsIMsgDBHdr object whose text body will be read
* @param aGetText: if true, return header objects. if false, return body data.
* @return Map(partnum -> message headers)
--- a/mail/test/mozmill/composition/test-charset-upgrade.js
+++ b/mail/test/mozmill/composition/test-charset-upgrade.js
@@ -24,21 +24,21 @@ function setupModule(module) {
for (let req of MODULE_REQUIRES) {
collector.getModule(req).installInto(module);
}
gDrafts = get_special_folder(Ci.nsMsgFolderFlags.Drafts, true);
gOutbox = get_special_folder(Ci.nsMsgFolderFlags.Queue);
// Ensure reply charset isn't UTF-8, otherwise there's no need to upgrade,
// which is what this test tests.
- let str = Components.classes["@mozilla.org/pref-localizedstring;1"]
- .createInstance(Components.interfaces.nsIPrefLocalizedString);
+ let str = Cc["@mozilla.org/pref-localizedstring;1"]
+ .createInstance(Ci.nsIPrefLocalizedString);
str.data = "windows-1252";
Services.prefs.setComplexValue("mailnews.send_default_charset",
- Components.interfaces.nsIPrefLocalizedString, str);
+ Ci.nsIPrefLocalizedString, str);
// Don't create paragraphs in the test.
// When creating a paragraph, the test fails to retrieve the
// original character set windows-1252. Until we understand why,
// we run without paragraphs.
Services.prefs.setBoolPref("mail.compose.default_to_paragraph", false);
}
--- a/mail/test/mozmill/composition/test-save-changes-on-quit.js
+++ b/mail/test/mozmill/composition/test-save-changes-on-quit.js
@@ -33,19 +33,19 @@ function setupModule(module) {
add_message_to_folder(folder, create_message()); // row 0
let localFolder = folder.QueryInterface(Ci.nsIMsgLocalMailFolder);
localFolder.addMessage(msgSource("content type: text", "text")); // row 1
localFolder.addMessage(msgSource("content type missing", null)); // row 2
}
function msgSource(aSubject, aContentType) {
- let msgId = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator)
- .generateUUID() + "@invalid";
+ let msgId = Cc["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator)
+ .generateUUID() + "@invalid";
return "From - Sun Apr 07 22:47:11 2013\r\n" +
"X-Mozilla-Status: 0001\r\n" +
"X-Mozilla-Status2: 00000000\r\n" +
"Message-ID: <" + msgId + ">\r\n" +
"Date: Sun, 07 Apr 2013 22:47:11 +0300\r\n" +
"From: Someone <some.one@invalid>\r\n" +
"To: someone.else@invalid\r\n" +
@@ -69,17 +69,17 @@ function test_can_cancel_quit_on_changes
// opening a new compose window
cwc = open_compose_new_mail(mc);
// Make some changes
cwc.type(cwc.eid("content-frame"), "Hey check out this megalol link");
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
+ .createInstance(Ci.nsISupportsPRBool);
// Set the Mock Prompt Service to return false, so that we
// cancel the quit.
gMockPromptService.returnValue = CANCEL;
// Trigger the quit-application-request notification
Services.obs.notifyObservers(cancelQuit, "quit-application-requested");
@@ -112,17 +112,17 @@ function test_can_quit_on_changes() {
// opening a new compose window
cwc = open_compose_new_mail(mc);
// Make some changes
cwc.type(cwc.eid("content-frame"), "Hey check out this megalol link");
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
+ .createInstance(Ci.nsISupportsPRBool);
// Set the Mock Prompt Service to return true, so that we're
// allowing the quit to occur.
gMockPromptService.returnValue = DONT_SAVE;
// Trigger the quit-application-request notification
Services.obs.notifyObservers(cancelQuit, "quit-application-requested");
@@ -155,17 +155,17 @@ function test_window_quit_state_reset_on
let cwc1 = open_compose_new_mail(mc);
let cwc2 = open_compose_new_mail(mc);
// Type something in each window.
cwc1.type(cwc1.eid("content-frame"), "Marco!");
cwc2.type(cwc2.eid("content-frame"), "Polo!");
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
+ .createInstance(Ci.nsISupportsPRBool);
// This is a hacky method for making sure that the second window
// receives a CANCEL click in the popup dialog.
var numOfPrompts = 0;
gMockPromptService.onPromptCallback = function() {
numOfPrompts++;
if (numOfPrompts > 1)
--- a/mail/test/mozmill/composition/test-send-format.js
+++ b/mail/test/mozmill/composition/test-send-format.js
@@ -12,17 +12,17 @@
var MODULE_NAME = "test-send-format";
var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers", "window-helpers"];
var os = {};
ChromeUtils.import('resource://mozmill/stdlib/os.js', os);
-const nsIMsgCompConvertible = Components.interfaces.nsIMsgCompConvertible;
+const nsIMsgCompConvertible = Ci.nsIMsgCompConvertible;
function setupModule(module) {
for (let lib of MODULE_REQUIRES) {
collector.getModule(lib).installInto(module);
}
}
function checkMsgFile(aFilePath, aConvertibility) {
--- a/mail/test/mozmill/content-policy/test-dns-prefetch.js
+++ b/mail/test/mozmill/content-policy/test-dns-prefetch.js
@@ -39,35 +39,35 @@ var setupModule = function (module) {
let cth = collector.getModule('content-tab-helpers');
cth.installInto(module);
folder = create_folder("dnsPrefetch");
};
function addToFolder(aSubject, aBody, aFolder) {
- let msgId = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator)
+ let msgId = Cc["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator)
.generateUUID() +"@mozillamessaging.invalid";
let source = "From - Sat Nov 1 12:39:54 2008\n" +
"X-Mozilla-Status: 0001\n" +
"X-Mozilla-Status2: 00000000\n" +
"Message-ID: <" + msgId + ">\n" +
"Date: Wed, 11 Jun 2008 20:32:02 -0400\n" +
"From: Tester <tests@mozillamessaging.invalid>\n" +
"User-Agent: Thunderbird 3.0a2pre (Macintosh/2008052122)\n" +
"MIME-Version: 1.0\n" +
"To: recipient@mozillamessaging.invalid\n" +
"Subject: " + aSubject + "\n" +
"Content-Type: text/html; charset=ISO-8859-1\n" +
"Content-Transfer-Encoding: 7bit\n" +
"\n" + aBody + "\n";
- aFolder.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
+ aFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
aFolder.gettingNewMessages = true;
aFolder.addMessage(source);
aFolder.gettingNewMessages = false;
return aFolder.msgDatabase.getMsgHdrForMessageID(msgId);
}
--- a/mail/test/mozmill/content-policy/test-exposed-in-content-tabs.js
+++ b/mail/test/mozmill/content-policy/test-exposed-in-content-tabs.js
@@ -40,35 +40,35 @@ var setupModule = function (module) {
let cth = collector.getModule('content-tab-helpers');
cth.installInto(module);
folder = create_folder("exposedInContent");
};
function addToFolder(aSubject, aBody, aFolder) {
- let msgId = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator)
+ let msgId = Cc["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator)
.generateUUID() +"@mozillamessaging.invalid";
let source = "From - Sat Nov 1 12:39:54 2008\n" +
"X-Mozilla-Status: 0001\n" +
"X-Mozilla-Status2: 00000000\n" +
"Message-ID: <" + msgId + ">\n" +
"Date: Wed, 11 Jun 2008 20:32:02 -0400\n" +
"From: Tester <tests@mozillamessaging.invalid>\n" +
"User-Agent: Thunderbird 3.0a2pre (Macintosh/2008052122)\n" +
"MIME-Version: 1.0\n" +
"To: recipient@mozillamessaging.invalid\n" +
"Subject: " + aSubject + "\n" +
"Content-Type: text/html; charset=ISO-8859-1\n" +
"Content-Transfer-Encoding: 7bit\n" +
"\n" + aBody + "\n";
- aFolder.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
+ aFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
aFolder.gettingNewMessages = true;
aFolder.addMessage(source);
aFolder.gettingNewMessages = false;
return aFolder.msgDatabase.getMsgHdrForMessageID(msgId);
}
--- a/mail/test/mozmill/content-policy/test-general-content-policy.js
+++ b/mail/test/mozmill/content-policy/test-general-content-policy.js
@@ -104,35 +104,35 @@ var setupModule = function (module) {
collector.getModule(dep).installInto(module);
}
folder = create_folder("generalContentPolicy");
};
function addToFolder(aSubject, aBody, aFolder) {
- let msgId = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator)
+ let msgId = Cc["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator)
.generateUUID() +"@mozillamessaging.invalid";
let source = "From - Sat Nov 1 12:39:54 2008\n" +
"X-Mozilla-Status: 0001\n" +
"X-Mozilla-Status2: 00000000\n" +
"Message-ID: <" + msgId + ">\n" +
"Date: Wed, 11 Jun 2008 20:32:02 -0400\n" +
"From: Tester <tests@mozillamessaging.invalid>\n" +
"User-Agent: Thunderbird 3.0a2pre (Macintosh/2008052122)\n" +
"MIME-Version: 1.0\n" +
"To: recipient@mozillamessaging.invalid\n" +
"Subject: " + aSubject + "\n" +
"Content-Type: text/html; charset=ISO-8859-1\n" +
"Content-Transfer-Encoding: 7bit\n" +
"\n" + aBody + "\n";
- aFolder.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
+ aFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
aFolder.gettingNewMessages = true;
aFolder.addMessage(source);
aFolder.gettingNewMessages = false;
return aFolder.msgDatabase.getMsgHdrForMessageID(msgId);
}
@@ -454,30 +454,30 @@ function test_generalContentPolicy() {
checkEMLMessageWindow(TESTS[i], emlFile);
emlFile.remove(false);
}
}
}
// Copied from test-blocked-content.js.
function putHTMLOnClipboard(html) {
- let trans = Components.classes["@mozilla.org/widget/transferable;1"]
- .createInstance(Components.interfaces.nsITransferable);
+ let trans = Cc["@mozilla.org/widget/transferable;1"]
+ .createInstance(Ci.nsITransferable);
// Register supported data flavors
trans.init(null);
trans.addDataFlavor("text/html");
- let wapper = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ let wapper = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
wapper.data = html;
trans.setTransferData("text/html", wapper, wapper.data.length * 2);
Services.clipboard.setData(trans, null,
- Components.interfaces.nsIClipboard.kGlobalClipboard);
+ Ci.nsIClipboard.kGlobalClipboard);
}
function subtest_insertImageIntoReplyForward(aReplyType) {
let msgDbHdr = addToFolder("Test insert image into reply or forward",
"Stand by for image insertion ;-)",
folder);
gMsgNo++;
--- a/mail/test/mozmill/content-policy/test-js-content-policy.js
+++ b/mail/test/mozmill/content-policy/test-js-content-policy.js
@@ -32,18 +32,18 @@ function setupModule(module) {
};
function teardownModule(module) {
Services.prefs.clearUserPref("javascript.enabled");
}
function addToFolder(aSubject, aBody, aFolder) {
- let msgId = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator)
+ let msgId = Cc["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator)
.generateUUID() +"@mozillamessaging.invalid";
let source = "From - Sat Nov 1 12:39:54 2008\n" +
"X-Mozilla-Status: 0001\n" +
"X-Mozilla-Status2: 00000000\n" +
"Message-ID: <" + msgId + ">\n" +
"Date: Wed, 11 Jun 2008 20:32:02 -0400\n" +
"From: Tester <tests@mozillamessaging.invalid>\n" +
@@ -51,17 +51,17 @@ function addToFolder(aSubject, aBody, aF
"MIME-Version: 1.0\n" +
"To: recipient@mozillamessaging.invalid\n" +
"Subject: " + aSubject + "\n" +
"Content-Type: text/html; charset=ISO-8859-1\n" +
"Content-Transfer-Encoding: 7bit\n" +
"Content-Base: " + url + "remote-noscript.html\n" +
"\n" + aBody + "\n";
- aFolder.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
+ aFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
aFolder.gettingNewMessages = true;
aFolder.addMessage(source);
aFolder.gettingNewMessages = false;
return aFolder.msgDatabase.getMsgHdrForMessageID(msgId);
}
--- a/mail/test/mozmill/content-policy/test-plugins-policy.js
+++ b/mail/test/mozmill/content-policy/test-plugins-policy.js
@@ -42,22 +42,22 @@ var setupModule = function (module) {
composeHelper.installInto(module);
let cth = collector.getModule('content-tab-helpers');
cth.installInto(module);
folder = create_folder("pluginPolicy");
// Ensure the test plugin is enabled
let plugin = get_test_plugin();
- plugin.enabledState = Components.interfaces.nsIPluginTag.STATE_ENABLED;
+ plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
};
function addToFolder(aSubject, aBody, aFolder) {
- let msgId = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator)
+ let msgId = Cc["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator)
.generateUUID() +"@mozillamessaging.invalid";
let source = "From - Sat Nov 1 12:39:54 2008\n" +
"X-Mozilla-Status: 0001\n" +
"X-Mozilla-Status2: 00000000\n" +
"Message-ID: <" + msgId + ">\n" +
"Date: Wed, 11 Jun 2008 20:32:02 -0400\n" +
@@ -65,17 +65,17 @@ function addToFolder(aSubject, aBody, aF
"User-Agent: Thunderbird 3.0a2pre (Macintosh/2008052122)\n" +
"MIME-Version: 1.0\n" +
"To: recipient@mozillamessaging.invalid\n" +
"Subject: " + aSubject + "\n" +
"Content-Type: text/html; charset=ISO-8859-1\n" +
"Content-Transfer-Encoding: 7bit\n" +
"\n" + aBody + "\n";
- aFolder.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
+ aFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
aFolder.gettingNewMessages = true;
aFolder.addMessage(source);
aFolder.gettingNewMessages = false;
return aFolder.msgDatabase.getMsgHdrForMessageID(msgId);
}
--- a/mail/test/mozmill/content-policy/test-view-source.js
+++ b/mail/test/mozmill/content-policy/test-view-source.js
@@ -32,34 +32,34 @@ function setupModule(module) {
test_view_source_reload.__force_skip__ = true;
// Skip on mac, as we can't click the (native) menus to make it work.
if (mc.mozmillModule.isMac)
test_view_source_reload.__force_skip__ = true;
}
function addToFolder(aSubject, aBody, aFolder) {
- let msgId = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator)
+ let msgId = Cc["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator)
.generateUUID() +"@invalid";
let source = "From - Sat Nov 1 12:39:54 2008\n" +
"X-Mozilla-Status: 0001\n" +
"X-Mozilla-Status2: 00000000\n" +
"Message-ID: <" + msgId + ">\n" +
"Date: Wed, 11 Jun 2008 20:32:02 -0400\n" +
"From: Tester <tests@mozillamessaging.invalid>\n" +
"MIME-Version: 1.0\n" +
"To: anna@example.com\n" +
"Subject: " + aSubject + "\n" +
"Content-Type: text/plain; charset=ISO-8859-1\n" +
"Content-Transfer-Encoding: 7bit\n" +
"\n" + aBody + "\n";
- aFolder.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
+ aFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
aFolder.addMessage(source);
return aFolder.msgDatabase.getMsgHdrForMessageID(msgId);
}
/**
* Test that the view source character encoding can be changed,
* which requires content policy is correct for view-source:.
--- a/mail/test/mozmill/content-tabs/test-about-support.js
+++ b/mail/test/mozmill/content-tabs/test-about-support.js
@@ -256,18 +256,18 @@ function test_copy_to_clipboard_public()
// actually copying to it, we just retrieve what would have been copied to it
let transferable = tab.browser.contentWindow.getClipboardTransferable();
for (let flavor of ["text/html", "text/unicode"]) {
let data = {};
transferable.getTransferData(flavor, data, {});
let text = data.value.QueryInterface(Ci.nsISupportsString).data;
let contentBody;
if (flavor == "text/html") {
- let parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
- .createInstance(Ci.nsIDOMParser);
+ let parser = Cc["@mozilla.org/xmlextras/domparser;1"]
+ .createInstance(Ci.nsIDOMParser);
contentBody = parser.parseFromString(text, "text/html").body;
} else {
contentBody = text;
}
for (let str of ABOUT_SUPPORT_STRINGS) {
if (!check_text_in_body(contentBody, str))
mark_failure(["Unable to find \"" + str + "\" in flavor \"" + flavor + "\""]);
@@ -300,18 +300,18 @@ function test_copy_to_clipboard_private(
// actually copying to it, we just retrieve what would have been copied to it
let transferable = tab.browser.contentWindow.getClipboardTransferable();
for (let flavor of ["text/html", "text/unicode"]) {
let data = {};
transferable.getTransferData(flavor, data, {});
let text = data.value.QueryInterface(Ci.nsISupportsString).data;
let contentBody;
if (flavor == "text/html") {
- let parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
- .createInstance(Ci.nsIDOMParser);
+ let parser = Cc["@mozilla.org/xmlextras/domparser;1"]
+ .createInstance(Ci.nsIDOMParser);
contentBody = parser.parseFromString(text, "text/html").body;
} else {
contentBody = text;
}
for (let str of ABOUT_SUPPORT_STRINGS) {
if (!check_text_in_body(contentBody, str))
mark_failure(["Unable to find \"" + str + "\" in flavor \"" + flavor + "\""]);
--- a/mail/test/mozmill/content-tabs/test-plugin-crashing.js
+++ b/mail/test/mozmill/content-tabs/test-plugin-crashing.js
@@ -134,27 +134,27 @@ var PluginCrashObserver = {
},
observe: function(aSubject, aTopic, aData) {
if (aTopic != "plugin-crashed")
return;
try {
this.removeMinidump(
- aSubject.QueryInterface(Components.interfaces.nsIPropertyBag2));
+ aSubject.QueryInterface(Ci.nsIPropertyBag2));
} catch (ex) {
Cu.reportError(ex);
frame.events.fail({exception: ex, test: frame.events.currentTest});
}
},
removeMinidump: function PluginCrashObserver_removeMinidump(aPropBag) {
this._sawCrash = true;
- let profD = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ let profD = Services.dirsvc.get("ProfD", Ci.nsIFile);
profD.append("minidumps");
// Let's check to see if a minidump was created. If so, delete
// it (along with the .extra file)
let crashId = aPropBag.getPropertyAsAString("pluginDumpID");
let dumpFile = profD.clone();
dumpFile.append(crashId + ".dmp");
let extraFile = profD.clone();
--- a/mail/test/mozmill/content-tabs/test-plugin-outdated.js
+++ b/mail/test/mozmill/content-tabs/test-plugin-outdated.js
@@ -36,17 +36,17 @@ function setupModule(module) {
// Stash the old plugin update URL so we can put it back on module
// teardown
gOldPluginUpdateUrl = Services.prefs.getCharPref(kPluginsUpdatePref);
Services.prefs.setCharPref(kStartPagePref, kPluginUrl);
Services.prefs.setCharPref(kPluginsUpdatePref, kPluginUpdateUrl);
let plugin = get_test_plugin();
- plugin.enabledState = Components.interfaces.nsIPluginTag.STATE_ENABLED;
+ plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
}
function teardownModule(module) {
Services.prefs.setCharPref(kStartPagePref, gOldStartUrl);
Services.prefs.setCharPref(kPluginsUpdatePref, gOldPluginUpdateUrl);
}
function test_outdated_plugin_notification() {
--- a/mail/test/mozmill/folder-display/test-invalid-db-folder-load.js
+++ b/mail/test/mozmill/folder-display/test-invalid-db-folder-load.js
@@ -12,17 +12,17 @@ var MODULE_NAME = 'test-invalid-db-folde
var RELATIVE_ROOT = '../shared-modules';
var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers'];
var folder;
var setA;
var curMessage;
-var nsMsgViewSortType = Components.interfaces.nsMsgViewSortType;
+var nsMsgViewSortType = Ci.nsMsgViewSortType;
function setupModule(module) {
let fdh = collector.getModule('folder-display-helpers');
fdh.installInto(module);
let wh = collector.getModule('window-helpers');
wh.installInto(module);
folder = create_folder("InvalidMSF");
--- a/mail/test/mozmill/folder-tree-modes/test-custom-smart-folder.js
+++ b/mail/test/mozmill/folder-tree-modes/test-custom-smart-folder.js
@@ -16,17 +16,17 @@ var MODULE_REQUIRES = ["folder-display-h
var smartParentNameA="My Smart Folder A";
var smartParentNameB="My Smart Folder B";
var rootFolder;
var inboxSubfolder, subfolderA, subfolderB;
var smartInboxFolder;
var smartFolderA;
-var nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+var nsMsgFolderFlags = Ci.nsMsgFolderFlags;
/**
* create two smart folder types and two real folders, one for each
* smart folder type
*/
function setupModule(module) {
let fdh = collector.getModule("folder-display-helpers");
fdh.installInto(module);
--- a/mail/test/mozmill/folder-tree-modes/test-smart-folders.js
+++ b/mail/test/mozmill/folder-tree-modes/test-smart-folders.js
@@ -17,17 +17,17 @@ var rootFolder;
var inboxSubfolder;
var trashFolder;
var trashSubfolder;
var smartInboxFolder;
var inboxSet;
-var nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+var nsMsgFolderFlags = Ci.nsMsgFolderFlags;
function setupModule(module) {
let fdh = collector.getModule("folder-display-helpers");
fdh.installInto(module);
rootFolder = inboxFolder.server.rootFolder;
// Create a folder as a subfolder of the inbox
--- a/mail/test/mozmill/folder-tree-modes/test-unread-folders.js
+++ b/mail/test/mozmill/folder-tree-modes/test-unread-folders.js
@@ -14,17 +14,17 @@ var RELATIVE_ROOT = "../shared-modules";
var MODULE_REQUIRES = ["folder-display-helpers"];
var rootFolder;
var inboxSubfolder;
var trashFolder;
var trashSubfolder;
var inboxSet;
-var nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+var nsMsgFolderFlags = Ci.nsMsgFolderFlags;
function setupModule(module) {
let fdh = collector.getModule("folder-display-helpers");
fdh.installInto(module);
rootFolder = inboxFolder.server.rootFolder;
// Create a folder as a subfolder of the inbox
--- a/mail/test/mozmill/folder-widget/test-message-filters.js
+++ b/mail/test/mozmill/folder-widget/test-message-filters.js
@@ -138,20 +138,20 @@ function create_simple_filter() {
// the previous tests.
let filterc = wait_for_existing_window("mailnews:filterlist");
function fill_in_filter_fields(fec) {
let filterName = fec.e("filterName");
filterName.value = "A Simple Filter";
let searchAttr = fec.e("searchAttr0");
let attrList = fec.window.document.getAnonymousNodes(searchAttr)[0];
- attrList.value = Components.interfaces.nsMsgSearchAttrib.To;
+ attrList.value = Ci.nsMsgSearchAttrib.To;
let searchOp = fec.e("searchOp0");
let opList = fec.window.document.getAnonymousNodes(searchOp)[0];
- opList.value = Components.interfaces.nsMsgSearchOp.Is;
+ opList.value = Ci.nsMsgSearchOp.Is;
let searchValList = fec.e("searchVal0");
let searchVal = fec.window.document.getAnonymousNodes(searchValList)[0];
searchVal.setAttribute("value", "test@foo.invalid");
let filterActions = fec.e("filterActionList");
let firstAction = filterActions.getItemAtIndex(0);
firstAction.setAttribute("value", "markasflagged");
fec.e("FilterEditor").acceptDialog();
@@ -183,20 +183,20 @@ function test_address_books_appear_in_me
// the previous tests.
let filterc = wait_for_existing_window("mailnews:filterlist");
// Prepare a function to deal with the filter editor once it
// has opened
function filterEditorOpened(fec) {
let searchAttr = fec.e("searchAttr0");
let attrList = fec.window.document.getAnonymousNodes(searchAttr)[0];
- attrList.value = Components.interfaces.nsMsgSearchAttrib.To;
+ attrList.value = Ci.nsMsgSearchAttrib.To;
let searchOp = fec.e("searchOp0");
let opList = fec.window.document.getAnonymousNodes(searchOp)[0];
- opList.value = Components.interfaces.nsMsgSearchOp.IsInAB;
+ opList.value = Ci.nsMsgSearchOp.IsInAB;
let searchValue = fec.e("searchVal0");
// The magic number "4" is because the address book list is the
// 4th child node of the searchvalue widget.
let abList = fec.window.document.getAnonymousNodes(searchValue)[4];
// We should have 2 address books here - one for the Personal Address
// Book, and one for Collected Addresses. The LDAP address book should
@@ -224,17 +224,17 @@ function test_can_cancel_quit_on_filter_
create_simple_filter();
let filterc = wait_for_existing_window("mailnews:filterlist");
let runButton = filterc.e("runFiltersButton");
runButton.setAttribute("label",
runButton.getAttribute("stoplabel"));
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
+ .createInstance(Ci.nsISupportsPRBool);
// Set the Mock Prompt Service to return false, so that we
// cancel the quit.
gMockPromptService.returnValue = false;
// Trigger the quit-application-request notification
Services.obs.notifyObservers(cancelQuit, "quit-application-requested");
let promptState = gMockPromptService.promptState;
assert_not_equals(null, promptState, "Expected a confirmEx prompt");
@@ -265,17 +265,17 @@ function test_can_quit_on_filter_changes
let filterCount = filterc.e("filterList").itemCount;
assert_equals(filterCount, 1);
let runButton = filterc.e("runFiltersButton");
runButton.setAttribute("label",
runButton.getAttribute("stoplabel"));
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
+ .createInstance(Ci.nsISupportsPRBool);
// Set the Mock Prompt Service to return true, so that we
// allow the quit.
gMockPromptService.returnValue = true;
// Trigger the quit-application-request notification
Services.obs.notifyObservers(cancelQuit, "quit-application-requested");
let promptState = gMockPromptService.promptState;
assert_not_equals(null, promptState, "Expected a confirmEx prompt");
--- a/mail/test/mozmill/notification/test-notification.js
+++ b/mail/test/mozmill/notification/test-notification.js
@@ -29,17 +29,17 @@ var gMockAlertsService = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAlertsService]),
showAlertNotification: function(imageUrl, title, text, textClickable, cookie,
alertListener, name) {
// Setting the _doFail flag allows us to revert to the newmailalert.xul
// notification
if (this._doFail) {
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
}
this._didNotify = true;
this._imageUrl = imageUrl;
this._title = title;
this._text = text;
this._textClickable = textClickable;
this._cookie = cookie;
this._alertListener = alertListener;
--- a/mail/test/mozmill/pref-window/test-font-chooser.js
+++ b/mail/test/mozmill/pref-window/test-font-chooser.js
@@ -35,18 +35,18 @@ function setupModule(module) {
}
let finished = false;
buildFontList().then(() => finished = true, Cu.reportError);
mc.waitFor(() => finished, "Timeout waiting for font enumeration to complete.");
}
async function buildFontList() {
- gFontEnumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
- .createInstance(Components.interfaces.nsIFontEnumerator);
+ gFontEnumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
+ .createInstance(Ci.nsIFontEnumerator);
for (let fontType of kFontTypes) {
gRealFontLists[fontType] =
await gFontEnumerator.EnumerateFontsAsync(kLanguage, fontType);
if (gRealFontLists[fontType].length == 0)
throw new Error("No fonts found for language " + kLanguage +
" and font type " + fontType + ".");
}
}
--- a/mail/test/mozmill/quick-filter-bar/test-filter-logic.js
+++ b/mail/test/mozmill/quick-filter-bar/test-filter-logic.js
@@ -90,18 +90,18 @@ function test_filter_attachments() {
function add_email_to_address_book(aEmailAddr) {
let card = Cc["@mozilla.org/addressbook/cardproperty;1"]
.createInstance(Ci.nsIAbCard);
card.primaryEmail = aEmailAddr;
let enumerator = MailServices.ab.directories;
while (enumerator.hasMoreElements()) {
let addrbook = enumerator.getNext();
- if (addrbook instanceof Components.interfaces.nsIAbMDBDirectory &&
- addrbook instanceof Components.interfaces.nsIAbDirectory) {
+ if (addrbook instanceof Ci.nsIAbMDBDirectory &&
+ addrbook instanceof Ci.nsIAbDirectory) {
addrbook.addCard(card);
return;
}
}
throw new Error("Unable to find any suitable address book.");
}
--- a/mail/test/mozmill/shared-modules/test-mock-object-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-mock-object-helpers.js
@@ -18,17 +18,17 @@ function MockObjectRegisterer(aContractI
}
MockObjectRegisterer.prototype = {
register: function MOR_register() {
let providedConstructor = this._component;
this._mockFactory = {
createInstance: function MF_createInstance(aOuter, aIid) {
if (aOuter != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return new providedConstructor().QueryInterface(aIid);
}
};
let componentRegistrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
componentRegistrar.registerFactory(this._cid,
"",
@@ -78,17 +78,17 @@ MockObjectReplacer.prototype = {
if (this._originalFactory)
throw Error("Invalid object state when calling register()");
// Define a factory that creates a new object using the given constructor.
var providedConstructor = this._replacementCtor;
this._mockFactory = {
createInstance: function MF_createInstance(aOuter, aIid) {
if (aOuter != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return new providedConstructor().QueryInterface(aIid);
}
};
var retVal = swapFactoryRegistration(this._cid, this._contractID, this._mockFactory, this._originalFactory);
if ('error' in retVal) {
throw new Exception("ERROR: " + retVal.error);
} else {
--- a/mail/test/resources/jsbridge/jsbridge/extension/components/cmdarg.js
+++ b/mail/test/resources/jsbridge/jsbridge/extension/components/cmdarg.js
@@ -1,50 +1,50 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-var nsIAppShellService = Components.interfaces.nsIAppShellService;
-var nsISupports = Components.interfaces.nsISupports;
-var nsICategoryManager = Components.interfaces.nsICategoryManager;
-var nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
-var nsICommandLine = Components.interfaces.nsICommandLine;
-var nsICommandLineHandler = Components.interfaces.nsICommandLineHandler;
-var nsIFactory = Components.interfaces.nsIFactory;
-var nsIModule = Components.interfaces.nsIModule;
-var nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
+var nsIAppShellService = Ci.nsIAppShellService;
+var nsISupports = Ci.nsISupports;
+var nsICategoryManager = Ci.nsICategoryManager;
+var nsIComponentRegistrar = Ci.nsIComponentRegistrar;
+var nsICommandLine = Ci.nsICommandLine;
+var nsICommandLineHandler = Ci.nsICommandLineHandler;
+var nsIFactory = Ci.nsIFactory;
+var nsIModule = Ci.nsIModule;
+var nsIWindowWatcher = Ci.nsIWindowWatcher;
// CHANGEME: to the chrome URI of your extension or application
var CHROME_URI = "chrome://jsbridge/content/";
// CHANGEME: change the contract id, CID, and category to be unique
// to your application.
var clh_contractID = "@mozilla.org/commandlinehandler/general-startup;1?type=jsbridge";
// use uuidgen to generate a unique ID
var clh_CID = Components.ID("{2872d428-14f6-11de-ac86-001f5bd9235c}");
// category names are sorted alphabetically. Typical command-line handlers use a
// category that begins with the letter "m".
var clh_category = "jsbridge";
-var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
- getService(Components.interfaces.nsIConsoleService);
+var aConsoleService = Cc["@mozilla.org/consoleservice;1"].
+ getService(Ci.nsIConsoleService);
/**
* Utility functions
*/
/**
* Opens a chrome window.
* @param aChromeURISpec a string specifying the URI of the window to open.
* @param aArgument an argument to pass to the window (may be null)
*/
function openWindow(aChromeURISpec, aArgument)
{
- var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"].
- getService(Components.interfaces.nsIWindowWatcher);
+ var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
+ getService(Ci.nsIWindowWatcher);
ww.openWindow(null, aChromeURISpec, "_blank",
"chrome,menubar,toolbar,status,resizable,dialog=no",
aArgument);
}
/**
* The XPCOM component that implements nsICommandLineHandler.
* It also implements nsIFactory to serve as its own singleton factory.
@@ -60,17 +60,17 @@ jsbridgeHandler.prototype = {
/* nsISupports */
QueryInterface : function clh_QI(iid)
{
if (iid.equals(nsICommandLineHandler) ||
iid.equals(nsIFactory) ||
iid.equals(nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
/* nsICommandLineHandler */
handle : function clh_handle(cmdLine)
{
try {
var port = cmdLine.handleFlagWithParam("jsbridge", false);
@@ -80,17 +80,17 @@ jsbridgeHandler.prototype = {
server.startServer(parseInt(port));
} else {
var server = {};
ChromeUtils.import('resource://jsbridge/modules/server.js', server);
server.startServer(24242);
}
}
catch (e) {
- Components.utils.reportError("incorrect parameter passed to -jsbridge on the command line.");
+ Cu.reportError("incorrect parameter passed to -jsbridge on the command line.");
}
},
// CHANGEME: change the help info as appropriate, but
// follow the guidelines in nsICommandLineHandler.idl
// specifically, flag descriptions should start at
// character 24, and lines should be wrapped at
@@ -98,17 +98,17 @@ jsbridgeHandler.prototype = {
// and finally, the string should end with a newline
helpInfo : " -jsbridge Port to run jsbridge on.\n",
/* nsIFactory */
createInstance : function clh_CI(outer, iid)
{
if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid);
},
lockFactory : function clh_lock(lock)
{
/* no-op */
}
--- a/mail/test/resources/jsbridge/jsbridge/extension/resource/modules/server.js
+++ b/mail/test/resources/jsbridge/jsbridge/extension/resource/modules/server.js
@@ -39,26 +39,26 @@
var EXPORTED_SYMBOLS = ["Server", "server", "AsyncRead", "Session", "sessions", "globalRegistry", "startServer"];
var events = {}; ChromeUtils.import("resource://jsbridge/modules/events.js", events);
var DEBUG_ON = false;
var BUFFER_SIZE = 1024;
var loader = Cc['@mozilla.org/moz/jssubscript-loader;1']
.getService(Ci.mozIJSSubScriptLoader);
-var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
- .getService(Components.interfaces.nsIAppShellService)
+var hwindow = Cc["@mozilla.org/appshell/appShellService;1"]
+ .getService(Ci.nsIAppShellService)
.hiddenDOMWindow;
var json2 = ChromeUtils.import("resource://jsbridge/modules/json2.js");
var jsonEncode = json2.JSON.stringify;
-var uuidgen = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator);
+var uuidgen = Cc["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator);
function AsyncRead (session) {
this.session = session;
}
AsyncRead.prototype.onStartRequest = function (request, context) {};
AsyncRead.prototype.onStopRequest = function (request, context, status) {
log("async onstoprequest: onstoprequest");
this.session.onQuit();
@@ -196,17 +196,17 @@ Bridge.prototype.execFunction = function
throw 'JSBridge unknown data in execFunc';
}
}
var backstage = this;
function Session (transport) {
this.transpart = transport; // XXX Unused, needed to hold reference? Note the typo.
- this.sandbox = Components.utils.Sandbox(backstage, { wantGlobalProperties: ["ChromeUtils"] });
+ this.sandbox = Cu.Sandbox(backstage, { wantGlobalProperties: ["ChromeUtils"] });
this.sandbox.bridge = new Bridge(this);
this.sandbox.openPreferences = hwindow.openPreferences;
try {
this.outputstream = transport.openOutputStream(Ci.nsITransport.OPEN_BLOCKING, 0, 0);
this.outstream = Cc['@mozilla.org/intl/converter-output-stream;1']
.createInstance(Ci.nsIConverterOutputStream);
this.outstream.init(this.outputstream, 'UTF-8');
this.stream = transport.openInputStream(0, 0, 0);
@@ -270,17 +270,17 @@ Session.prototype.encodeOut = function (
} else {
var exception = {'name':e.name, 'message':e.message};
}
this.onOutput(jsonEncode({'result':false, 'exception':exception}));
}
}
Session.prototype.receive = function(data) {
- Components.utils.evalInSandbox(data, this.sandbox);
+ Cu.evalInSandbox(data, this.sandbox);
}
var sessions = {
_list: [],
add: function(session) {
this._list.push(session);
},
remove: function(session) {
--- a/mail/test/resources/mozmill/mozmill/extension/content/dx.js
+++ b/mail/test/resources/mozmill/mozmill/extension/content/dx.js
@@ -102,29 +102,29 @@ DomInspectorConnector.prototype.dxOn = f
$("#dxToggle").text("Stop");
//defined the click method, default to dblclick
var clickMethod = "dblclick";
if (document.getElementById('inspectSingle').checked){
clickMethod = 'click';
}
- var enumerator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
+ var enumerator = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator)
.getEnumerator("");
while(enumerator.hasMoreElements()) {
var win = enumerator.getNext();
if (win.document.title != 'MozMill IDE'){
this.dxRecursiveBind(win, clickMethod);
}
}
var observerService =
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
observerService.addObserver(this.observer, "toplevel-window-ready");
};
//when a new dom window gets opened
DomInspectorConnector.prototype.observer = {
observe: function(subject,topic,data){
var clickMethod = "dblclick";
@@ -150,18 +150,18 @@ DomInspectorConnector.prototype.dxOff =
this.dxRecursiveUnBind(win, 'click');
}
for (let win of utils.getWindows()) {
this.dxRecursiveUnBind(win, 'dblclick');
}
var observerService =
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
try {
observerService.removeObserver(this.observer, "toplevel-window-ready");
} catch(err){}
};
DomInspectorConnector.prototype.getFoc = function(e){
MozMilldx.dxOff();
--- a/mail/test/resources/mozmill/mozmill/extension/content/inspector.js
+++ b/mail/test/resources/mozmill/mozmill/extension/content/inspector.js
@@ -22,18 +22,18 @@ var showRecordDialog = function(){
$("#tabs").tabs().tabs("select", 0);
$("#recordDialog").dialog("open");
MozMillrec.on();
$("#recordDialog").dialog().parents(".ui-dialog:first").find(".ui-dialog-buttonpane button")[1].innerHTML = "Stop";
}
//Align mozmill to all the other open windows in a way that makes it usable
var align = function(){
- var enumerator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
+ var enumerator = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator)
.getEnumerator("");
while(enumerator.hasMoreElements()) {
var win = enumerator.getNext();
if (win.document.title != 'MozMill IDE'){
var wintype = win.document.documentElement.getAttribute("windowtype");
//move to top left corner
win.screenY = 0;
win.screenX = 0;
@@ -41,18 +41,18 @@ var align = function(){
//make only browser windows big
if (wintype == "navigator:browser"){
var width = window.screen.availWidth/2.5;
var height = window.screen.availHeight;
win.resizeTo((window.screen.availWidth - width), window.screen.availHeight);
}
}
else {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
+ var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator);
var latestbrowser = wm.getMostRecentWindow('navigator:browser');
//if there is no most recent browser window, use whatever window
if (!latestbrowser){
var latestbrowser = wm.getMostRecentWindow('');
}
win.screenX = latestbrowser.innerWidth;
--- a/mail/test/resources/mozmill/mozmill/extension/content/menus.js
+++ b/mail/test/resources/mozmill/mozmill/extension/content/menus.js
@@ -91,33 +91,33 @@ function saveFile() {
function closeFile() {
$("#tabs").tabs("select", 0);
var really = confirm("Are you sure you want to close this file?");
if (really == true)
editor.closeCurrentTab();
}
function runFile(){
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, "Select a File", nsIFilePicker.modeOpen);
fp.appendFilter("JavaScript Files","*.js");
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.file) {
return;
}
$("#tabs").tabs("select", 1);
frame.runTestFile(fp.file.path, true);
testFinished();
});
}
function runDirectory(){
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, "Select a Directory", nsIFilePicker.modeGetFolder);
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.file) {
return;
}
$("#tabs").tabs("select", 1);
frame.runTestDirectory(fp.file.path, true);
testFinished();
@@ -146,15 +146,15 @@ function newTemplate(){
editor.openNew(template);
}
function tabSelected(selector) {
editor.switchTab(selector.selectedIndex);
}
function openHelp() {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
+ var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator);
var browser = wm.getMostRecentWindow("navigator:browser").gBrowser;
browser.selectedTab =
browser.addTab("http://quality.mozilla.org/docs/mozmill/getting-started/");
}
--- a/mail/test/resources/mozmill/mozmill/extension/content/output.js
+++ b/mail/test/resources/mozmill/mozmill/extension/content/output.js
@@ -35,18 +35,18 @@
// the terms of any one of the MPL, the GPL or the LGPL.
//
// ***** END LICENSE BLOCK *****
var arrays = {}; ChromeUtils.import('resource://mozmill/stdlib/arrays.js', arrays);
var json2 = {}; ChromeUtils.import('resource://mozmill/stdlib/json2.js', json2);
var utils = {}; ChromeUtils.import('resource://mozmill/modules/utils.js', utils);
-var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
- getService(Components.interfaces.nsIConsoleService);
+var aConsoleService = Cc["@mozilla.org/consoleservice;1"].
+ getService(Ci.nsIConsoleService);
var createCell = function (t, obj, message) {
// try {
// alert(json2.JSON.stringify(message.exception.message));
// } catch(err){}
// //alert(msgObj.exception.message);
//
--- a/mail/test/resources/mozmill/mozmill/extension/content/shell.js
+++ b/mail/test/resources/mozmill/mozmill/extension/content/shell.js
@@ -1,22 +1,22 @@
var controller = {}; ChromeUtils.import('resource://mozmill/modules/controller.js', controller);
var events = {}; ChromeUtils.import('resource://mozmill/modules/events.js', events);
var utils = {}; ChromeUtils.import('resource://mozmill/modules/utils.js', utils);
var elementslib = {}; ChromeUtils.import('resource://mozmill/modules/elementslib.js', elementslib);
var frame = {}; ChromeUtils.import('resource://mozmill/modules/frame.js', frame);
var that = this;
-var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
- .getService(Components.interfaces.nsIAppShellService)
+var hwindow = Cc["@mozilla.org/appshell/appShellService;1"]
+ .getService(Ci.nsIAppShellService)
.hiddenDOMWindow;
-var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
+var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator);
var dir = function(obj){
for (let prop in obj){
shell.send(prop);
}
}
var shell = new function(){
@@ -60,18 +60,18 @@ var shell = new function(){
this.send = function(s){
if (s == undefined){
return;
}
shell.sout().insertBefore(shell.entry(s), shell.sout().childNodes[0]);
};
this.getWindows = function(){
- var enumerator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
+ var enumerator = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator)
.getEnumerator("");
var s = "";
//define an array we can access
shell.windows = [];
windows = shell.windows;
var c = 1;
while (enumerator.hasMoreElements()) {
let win = enumerator.getNext();
--- a/mail/test/resources/mozmill/mozmill/extension/content/ui.js
+++ b/mail/test/resources/mozmill/mozmill/extension/content/ui.js
@@ -48,28 +48,28 @@ function accessOutput(){
txt += n.childNodes[c].value + '\n';
}
}
if (txt == undefined){ return; }
copyToClipboard(txt);
}
var copyToClipboard = function(str){
- const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] .getService(Components.interfaces.nsIClipboardHelper);
+ const gClipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"] .getService(Ci.nsIClipboardHelper);
gClipboardHelper.copyString(str);
}
var showFileDialog = function(){
$("#fileDialog").dialog("open");
}
//Align mozmill to all the other open windows in a way that makes it usable
var align = function(){
- var enumerator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
+ var enumerator = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator)
.getEnumerator("");
while(enumerator.hasMoreElements()) {
var win = enumerator.getNext();
if (win.document.title != 'MozMill IDE'){
var wintype = win.document.documentElement.getAttribute("windowtype");
//move to top left corner
win.screenY = 0;
win.screenX = 0;
@@ -77,18 +77,18 @@ var align = function(){
//make only browser windows big
if (wintype == "navigator:browser"){
var width = window.screen.availWidth/2.5;
var height = window.screen.availHeight;
win.resizeTo((window.screen.availWidth - width), window.screen.availHeight);
}
}
else {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
+ var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator);
var latestbrowser = wm.getMostRecentWindow('navigator:browser');
//if there is no most recent browser window, use whatever window
if (!latestbrowser){
var latestbrowser = wm.getMostRecentWindow('');
}
win.screenX = latestbrowser.innerWidth;
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/controller.js
+++ b/mail/test/resources/mozmill/mozmill/extension/resource/modules/controller.js
@@ -43,21 +43,21 @@ var EXPORTED_SYMBOLS = ["MozMillControll
var EventUtils = {}; ChromeUtils.import('resource://mozmill/stdlib/EventUtils.js', EventUtils);
var events = {}; ChromeUtils.import('resource://mozmill/modules/events.js', events);
var utils = {}; ChromeUtils.import('resource://mozmill/modules/utils.js', utils);
var elementslib = {}; ChromeUtils.import('resource://mozmill/modules/elementslib.js', elementslib);
var frame = {}; ChromeUtils.import('resource://mozmill/modules/frame.js', frame);
-var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
- .getService(Components.interfaces.nsIAppShellService)
+var hwindow = Cc["@mozilla.org/appshell/appShellService;1"]
+ .getService(Ci.nsIAppShellService)
.hiddenDOMWindow;
-var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
- getService(Components.interfaces.nsIConsoleService);
+var aConsoleService = Cc["@mozilla.org/consoleservice;1"].
+ getService(Ci.nsIConsoleService);
// The window map which is used to store information e.g. loaded state of each
// open chrome and content window.
var windowMap = {
_windows : { },
contains : function (aWindowId) {
return (aWindowId in this._windows);
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/frame.js
+++ b/mail/test/resources/mozmill/mozmill/extension/resource/modules/frame.js
@@ -44,24 +44,24 @@ ChromeUtils.import('resource://mozmill/s
var os = {}; ChromeUtils.import('resource://mozmill/stdlib/os.js', os);
var strings = {}; ChromeUtils.import('resource://mozmill/stdlib/strings.js', strings);
var arrays = {}; ChromeUtils.import('resource://mozmill/stdlib/arrays.js', arrays);
var withs = {}; ChromeUtils.import('resource://mozmill/stdlib/withs.js', withs);
var utils = {}; ChromeUtils.import('resource://mozmill/modules/utils.js', utils);
var securableModule = {};
ChromeUtils.import('resource://mozmill/stdlib/securable-module.js', securableModule);
-var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
- getService(Components.interfaces.nsIConsoleService);
-var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
-var loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
- .getService(Components.interfaces.mozIJSSubScriptLoader);
-var uuidgen = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator);
+var aConsoleService = Cc["@mozilla.org/consoleservice;1"].
+ getService(Ci.nsIConsoleService);
+var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
+ .getService(Ci.mozIJSSubScriptLoader);
+var uuidgen = Cc["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator);
ChromeUtils.import("resource://gre/modules/Services.jsm");
var systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
var backstage = this;
var registeredFunctions = {};
@@ -86,22 +86,22 @@ var loadTestResources = function () {
}
if (elementslib == undefined) {
elementslib = {};
ChromeUtils.import("resource://mozmill/modules/elementslib.js", elementslib);
}
}
var loadFile = function(path, collector) {
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
file.initWithPath(path);
var uri = ios.newFileURI(file).spec;
- var module = new Components.utils.Sandbox(systemPrincipal, { wantGlobalProperties: ["ChromeUtils"] });
+ var module = new Cu.Sandbox(systemPrincipal, { wantGlobalProperties: ["ChromeUtils"] });
module.registeredFunctions = registeredFunctions;
module.collector = collector
loadTestResources();
module.mozmill = mozmill;
module.elementslib = elementslib;
module.persisted = persisted;
module.Cc = Components.classes;
module.Ci = Components.interfaces;
@@ -399,18 +399,18 @@ Collector.prototype.addHttpResource = fu
}
if (!ns) {
ns = '/';
} else {
ns = '/' + ns + '/';
}
- var lp = Components.classes["@mozilla.org/file/local;1"].
- createInstance(Components.interfaces.nsIFile);
+ var lp = Cc["@mozilla.org/file/local;1"].
+ createInstance(Ci.nsIFile);
lp.initWithPath(os.abspath(directory, this.current_file));
this.httpd.registerDirectory(ns, lp);
return 'http://localhost:' + this.http_port + ns
}
Collector.prototype.initTestModule = function (filename) {
var test_module = loadFile(filename, this);
@@ -494,23 +494,23 @@ Collector.prototype.initTestDirectory =
function AppQuitObserver() {
this.register();
}
AppQuitObserver.prototype = {
observe: function(subject, topic, data) {
events.appQuit = true;
},
register: function() {
- var obsService = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obsService = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
obsService.addObserver(this, "quit-application");
},
unregister: function() {
- var obsService = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obsService = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
obsService.removeObserver(this, "quit-application");
}
}
function Runner (collector, invokedFromIDE) {
this.collector = collector;
this.invokedFromIDE = invokedFromIDE
@@ -560,19 +560,19 @@ Runner.prototype.getDependencies = funct
}
}
}
return alldeps;
}
Runner.prototype.wrapper = function (func, arg) {
- thread = Components.classes["@mozilla.org/thread-manager;1"]
- .getService(Components.interfaces.nsIThreadManager)
- .currentThread;
+ thread = Cc["@mozilla.org/thread-manager;1"]
+ .getService(Ci.nsIThreadManager)
+ .currentThread;
if (func.EXCLUDED_PLATFORMS != undefined) {
if (arrays.inArray(func.EXCLUDED_PLATFORMS, this.platform)) {
events.skip("Platform exclusion");
return;
}
}
if (func.__force_skip__ != undefined) {
@@ -601,17 +601,17 @@ Runner.prototype.wrapper = function (fun
func = {
'filename':events.currentModule.__file__,
'name':func.__name__
}
}
// Allow the exception if a user shutdown was expected
if (!events.isUserShutdown()) {
events.fail({'exception': e, 'test':func})
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
}
Runner.prototype._runTestModule = function (module) {
if (module.__requirements__ != undefined && module.__force_skip__ == undefined) {
for (var req of module.__requirements__) {
module[req] = this.collector.getModule(req);
@@ -720,15 +720,15 @@ var runTestFile = function (filename, in
}
var getThread = function () {
return thread;
}
function registerModule(name, path) {
let protocolHandler = Services.io.getProtocolHandler("resource")
- .QueryInterface(Components.interfaces.nsIResProtocolHandler);
+ .QueryInterface(Ci.nsIResProtocolHandler);
- let modulesFile = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ let modulesFile = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
modulesFile.initWithPath(path);
protocolHandler.setSubstitution(name, ios.newFileURI(modulesFile));
}
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/inspection.js
+++ b/mail/test/resources/mozmill/mozmill/extension/resource/modules/inspection.js
@@ -42,18 +42,18 @@ var mozmill = {}; ChromeUtils.import('re
var utils = {}; ChromeUtils.import('resource://mozmill/modules/utils.js', utils);
var arrays = {}; ChromeUtils.import('resource://mozmill/stdlib/arrays.js', arrays);
var dom = {}; ChromeUtils.import('resource://mozmill/stdlib/dom.js', dom);
var objects = {}; ChromeUtils.import('resource://mozmill/stdlib/objects.js', objects);
var json2 = {}; ChromeUtils.import('resource://mozmill/stdlib/json2.js', json2);
var withs = {}; ChromeUtils.import('resource://mozmill/stdlib/withs.js', withs);
-var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
+var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator);
var isNotAnonymous = function (elem, result) {
if (result == undefined) {
var result = true;
}
if ( elem.parentNode ) {
var p = elem.parentNode;
return isNotAnonymous(p, result == arrays.inArray(p.childNodes, elem) == true);
@@ -256,17 +256,17 @@ var isMagicAnonymousDiv = function (_doc
!arrays.inArray(_document.getAnonymousNodes(node), node) ) ) {
return true;
}
}
return false;
}
var copyToClipboard = function(str){
- const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] .getService(Components.interfaces.nsIClipboardHelper);
+ const gClipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"] .getService(Ci.nsIClipboardHelper);
gClipboardHelper.copyString(str);
}
var getControllerAndDocument = function (_document, _window) {
var windowtype = _window.document.documentElement.getAttribute('windowtype');
var controllerString, documentString, activeTab;
// TODO replace with object based cases
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/mozmill.js
+++ b/mail/test/resources/mozmill/mozmill/extension/resource/modules/mozmill.js
@@ -66,28 +66,28 @@ if (platform == "darwin"){
}
if (platform == "winnt"){
isWindows = true;
}
if (platform == "linux"){
isLinux = true;
}
-var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
+var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator);
-var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULAppInfo);
+var appInfo = Cc["@mozilla.org/xre/app-info;1"]
+ .getService(Ci.nsIXULAppInfo);
-var locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
- .getService(Components.interfaces.nsIXULChromeRegistry)
+var locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
+ .getService(Ci.nsIXULChromeRegistry)
.getSelectedLocale("global");
-var aConsoleService = Components.classes["@mozilla.org/consoleservice;1"].
- getService(Components.interfaces.nsIConsoleService);
+var aConsoleService = Cc["@mozilla.org/consoleservice;1"].
+ getService(Ci.nsIConsoleService);
var applicationDictionary = {
"{718e30fb-e89b-41dd-9da7-e25a45638b28}": "Sunbird",
"{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}": "SeaMonkey",
"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}": "Firefox",
"{3550f703-e582-4d05-9a08-453d09bdfdc6}": 'Thunderbird',
}
--- a/mail/test/resources/mozmill/mozmill/extension/resource/modules/utils.js
+++ b/mail/test/resources/mozmill/mozmill/extension/resource/modules/utils.js
@@ -38,48 +38,48 @@
// ***** END LICENSE BLOCK *****
var EXPORTED_SYMBOLS = ["openFile", "saveFile", "saveAsFile", "genBoiler",
"getFile", "Copy", "getChromeWindow", "getWindows", "runEditor",
"runFile", "getWindowByTitle", "getWindowByType", "getWindowId",
"tempfile", "getMethodInWindows", "getPreference", "setPreference",
"sleep", "assert", "unwrapNode", "TimeoutError", "waitFor", "waitForEval"];
-var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
- .getService(Components.interfaces.nsIAppShellService)
+var hwindow = Cc["@mozilla.org/appshell/appShellService;1"]
+ .getService(Ci.nsIAppShellService)
.hiddenDOMWindow;
-var uuidgen = Components.classes["@mozilla.org/uuid-generator;1"]
- .getService(Components.interfaces.nsIUUIDGenerator);
+var uuidgen = Cc["@mozilla.org/uuid-generator;1"]
+ .getService(Ci.nsIUUIDGenerator);
function Copy (obj) {
for (var n in obj) {
this[n] = obj[n];
}
}
function getChromeWindow(aWindow) {
var chromeWin = aWindow
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow)
- .QueryInterface(Components.interfaces.nsIDOMChromeWindow);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow)
+ .QueryInterface(Ci.nsIDOMChromeWindow);
return chromeWin;
}
function getWindows(type) {
if (type == undefined) {
type = "";
}
var windows = []
- var enumerator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator)
+ var enumerator = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator)
.getEnumerator(type);
while(enumerator.hasMoreElements()) {
windows.push(enumerator.getNext());
}
if (type == "") {
windows.push(hwindow);
}
return windows;
@@ -98,18 +98,18 @@ function getWindowByTitle(title) {
for (var w of getWindows()) {
if (w.document.title && w.document.title == title) {
return w;
}
}
}
function getWindowByType(type) {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
+ var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
+ .getService(Ci.nsIWindowMediator);
return wm.getMostRecentWindow(type);
}
/**
* Retrieve the outer window id for the given window
**/
function getWindowId(aWindow) {
try {
@@ -122,38 +122,38 @@ function getWindowId(aWindow) {
return aWindow.QueryInterface(Ci.nsISupportsPRUint64).data;
}
}
function tempfile(appention) {
if (appention == undefined) {
var appention = "mozmill.utils.tempfile"
}
- var tempfile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("TmpD", Components.interfaces.nsIFile);
+ var tempfile = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
tempfile.append(uuidgen.generateUUID().toString().replace('-', '').replace('{', '').replace('}',''))
- tempfile.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0o777);
+ tempfile.create(Ci.nsIFile.DIRECTORY_TYPE, 0o777);
tempfile.append(appention);
- tempfile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0o666);
+ tempfile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
// do whatever you need to the created file
return tempfile.clone()
}
var checkChrome = function() {
var loc = window.document.location.href;
try {
loc = window.top.document.location.href;
} catch (e) {}
if (/^chrome:\/\//.test(loc)) { return true; }
else { return false; }
}
var runFile = function(w) {
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(w, "Select a File", nsIFilePicker.modeOpen);
fp.appendFilter("JavaScript Files","*.js");
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.files) {
return;
}
let thefile = fp.file;
//create the paramObj with a files array attrib
@@ -164,78 +164,78 @@ var runFile = function(w) {
//Move focus to output tab
//w.document.getElementById('mmtabs').setAttribute("selectedIndex", 2);
//send it into the JS test framework to run the file
// jstest.runFromFile(thefile.path);
});
};
var saveFile = function(w, content, filename){
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
file.initWithPath(filename);
// file is nsIFile, data is a string
- var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
- .createInstance(Components.interfaces.nsIFileOutputStream);
+ var foStream = Cc["@mozilla.org/network/file-output-stream;1"]
+ .createInstance(Ci.nsIFileOutputStream);
// use 0x02 | 0x10 to open file for appending.
foStream.init(file, 0x02 | 0x08 | 0x20, 0o666, 0);
// write, create, truncate
// In a c file operation, we have no need to set file mode with or operation,
// directly using "r" or "w" usually.
foStream.write(content, content.length);
foStream.close();
};
var saveAsFile = function(w, content) {
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(w, "Select a File", nsIFilePicker.modeSave);
fp.appendFilter("JavaScript Files","*.js");
return new Promise(resolve => {
fp.open(rv => {
if ((rv != nsIFilePicker.returnOK && rv != nsIFilePicker.returnReplace) || !fp.file) {
resolve(null)
return;
}
var thefile = fp.file;
// forcing the user to save as a .js file
if (thefile.path.indexOf(".js") == -1) {
// define the file interface
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
// point it at the file we want to get at
file.initWithPath(thefile.path+".js");
var thefile = file;
}
// file is nsIFile, data is a string
- var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
- .createInstance(Components.interfaces.nsIFileOutputStream);
+ var foStream = Cc["@mozilla.org/network/file-output-stream;1"]
+ .createInstance(Ci.nsIFileOutputStream);
// use 0x02 | 0x10 to open file for appending.
foStream.init(thefile, 0x02 | 0x08 | 0x20, 0o666, 0);
// write, create, truncate
// In a c file operation, we have no need to set file mode with or operation,
// directly using "r" or "w" usually.
foStream.write(content, content.length);
foStream.close();
resolve(thefile.path);
});
});
};
var openFile = function(w) {
//define the interface
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
//define the file picker window
fp.init(w, "Select a File", nsIFilePicker.modeOpen);
fp.appendFilter("JavaScript Files","*.js");
return new Promise(resolve => {
//show the window
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.file) {
resolve(null);
@@ -246,26 +246,26 @@ var runFile = function(w) {
var data = getFile(thefile.path);
resolve({path:thefile.path, data:data});
});
});
};
var getFile = function(path){
//define the file interface
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
//point it at the file we want to get at
file.initWithPath(path);
// define file stream interfaces
var data = "";
- var fstream = Components.classes["@mozilla.org/network/file-input-stream;1"]
- .createInstance(Components.interfaces.nsIFileInputStream);
- var sstream = Components.classes["@mozilla.org/scriptableinputstream;1"]
- .createInstance(Components.interfaces.nsIScriptableInputStream);
+ var fstream = Cc["@mozilla.org/network/file-input-stream;1"]
+ .createInstance(Ci.nsIFileInputStream);
+ var sstream = Cc["@mozilla.org/scriptableinputstream;1"]
+ .createInstance(Ci.nsIScriptableInputStream);
fstream.init(file, -1, 0, 0);
sstream.init(fstream);
//pull the contents of the file out
var str = sstream.read(4096);
while (str.length > 0) {
data += str;
str = sstream.read(4096);
@@ -286,18 +286,18 @@ var runFile = function(w) {
*
* @returns any The value of the requested preference
*
* @see setPref
* Code by Henrik Skupin: <hskupin@gmail.com>
*/
function getPreference(aPrefName, aDefaultValue) {
try {
- var branch = Components.classes["@mozilla.org/preferences-service;1"].
- getService(Components.interfaces.nsIPrefBranch);
+ var branch = Cc["@mozilla.org/preferences-service;1"].
+ getService(Ci.nsIPrefBranch);
switch (typeof aDefaultValue) {
case ('boolean'):
return branch.getBoolPref(aPrefName);
case ('string'):
return branch.getCharPref(aPrefName);
case ('number'):
return branch.getIntPref(aPrefName);
default:
@@ -316,18 +316,18 @@ function getPreference(aPrefName, aDefau
*
* @returns boolean Returns true if value was successfully set.
*
* @see getPref
* Code by Henrik Skupin: <hskupin@gmail.com>
*/
function setPreference(aName, aValue) {
try {
- var branch = Components.classes["@mozilla.org/preferences-service;1"].
- getService(Components.interfaces.nsIPrefBranch);
+ var branch = Cc["@mozilla.org/preferences-service;1"].
+ getService(Ci.nsIPrefBranch);
switch (typeof aValue) {
case ('boolean'):
branch.setBoolPref(aName, aValue);
break;
case ('string'):
branch.setCharPref(aName, aValue);
break;
case ('number'):
@@ -350,17 +350,17 @@ function setPreference(aName, aValue) {
* Sleeps the given number of milliseconds
*/
function sleep(milliseconds) {
// We basically just call this once after the specified number of milliseconds
var timeup = false;
function wait() { timeup = true; }
hwindow.setTimeout(wait, milliseconds);
- var thread = Components.classes["@mozilla.org/thread-manager;1"].
+ var thread = Cc["@mozilla.org/thread-manager;1"].
getService().currentThread;
while(!timeup) {
thread.processNextEvent(true);
}
}
/**
* Check if the callback function evaluates to true
@@ -425,17 +425,17 @@ function waitFor(callback, message, time
var self = {counter: 0, result: callback.call(thisObject)};
function wait() {
self.counter += interval;
self.result = callback.call(thisObject);
}
var timeoutInterval = hwindow.setInterval(wait, interval);
- var thread = Components.classes["@mozilla.org/thread-manager;1"].
+ var thread = Cc["@mozilla.org/thread-manager;1"].
getService().currentThread;
while((self.result != true) && (self.counter < timeout)) {
thread.processNextEvent(true);
}
hwindow.clearInterval(timeoutInterval);
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/EventUtils.js
+++ b/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/EventUtils.js
@@ -175,21 +175,21 @@ function __doEventDispatch(aTarget, aCha
}
/**
* Parse the key modifier flags from aEvent. Used to share code between
* synthesizeMouse and synthesizeKey.
*/
function _parseModifiers(aEvent)
{
- var hwindow = Components.classes["@mozilla.org/appshell/appShellService;1"]
- .getService(Components.interfaces.nsIAppShellService)
- .hiddenDOMWindow;
+ var hwindow = Cc["@mozilla.org/appshell/appShellService;1"]
+ .getService(Ci.nsIAppShellService)
+ .hiddenDOMWindow;
- const masks = Components.interfaces.nsIDOMNSEvent;
+ const masks = Ci.nsIDOMNSEvent;
var mval = 0;
if (aEvent.shiftKey)
mval |= masks.SHIFT_MASK;
if (aEvent.ctrlKey)
mval |= masks.CONTROL_MASK;
if (aEvent.altKey)
mval |= masks.ALT_MASK;
if (aEvent.metaKey)
@@ -214,18 +214,18 @@ function _parseModifiers(aEvent)
*
* aWindow is optional, and defaults to the current window object.
*/
function synthesizeMouse(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
{
if (!aWindow)
aWindow = window;
- var utils = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
+ var utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
+ getInterface(Ci.nsIDOMWindowUtils);
if (utils) {
var button = aEvent.button || 0;
var clickCount = aEvent.clickCount || 1;
var modifiers = _parseModifiers(aEvent);
var rect = aTarget.getBoundingClientRect();
var left = rect.left + aOffsetX;
@@ -262,18 +262,18 @@ function synthesizeMouse(aTarget, aOffse
*
* aWindow is optional, and defaults to the current window object.
*/
function synthesizeMouseScroll(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
{
if (!aWindow)
aWindow = window;
- var utils = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
+ var utils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
+ getInterface(Ci.nsIDOMWindowUtils);
if (utils) {
// See nsMouseScrollFlags in nsGUIEvent.h
const kIsVertical = 0x02;
const kIsHorizontal = 0x04;
const kHasPixels = 0x08;
var button = aEvent.button || 0;
var modifiers = _parseModifiers(aEvent);
@@ -589,29 +589,29 @@ function synthesizeDrop(srcElement, dest
synthesizeMouse(destElement, 20, 20, { type: "mouseup" }, aWindow);
return dataTransfer.dropEffect;
}
function disableNonTestMouseEvents(aDisable)
{
var utils =
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
+ window.QueryInterface(Ci.nsIInterfaceRequestor).
+ getInterface(Ci.nsIDOMWindowUtils);
if (utils)
utils.disableNonTestMouseEvents(aDisable);
}
function _getDOMWindowUtils(aWindow)
{
if (!aWindow) {
aWindow = window;
}
- return aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils);
+ return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
+ getInterface(Ci.nsIDOMWindowUtils);
}
/**
* Synthesize a composition event.
*
* @param aIsCompositionStart If true, this synthesize compositionstart event.
* Otherwise, compositionend event.
* @param aWindow Optional (If null, current |window| will be used)
@@ -859,18 +859,18 @@ function _getTIP(aWindow, aCallback)
if (!aWindow) {
aWindow = window;
}
var tip;
if (TIPMap.has(aWindow)) {
tip = TIPMap.get(aWindow);
} else {
tip =
- Components.classes["@mozilla.org/text-input-processor;1"].
- createInstance(Components.interfaces.nsITextInputProcessor);
+ Cc["@mozilla.org/text-input-processor;1"].
+ createInstance(Ci.nsITextInputProcessor);
TIPMap.set(aWindow, tip);
}
if (!tip.beginInputTransactionForTests(aWindow, aCallback)) {
tip = null;
TIPMap.delete(aWindow);
}
return tip;
}
@@ -1050,37 +1050,37 @@ function _createKeyboardEventDictionary(
var result = { dictionary: null, flags: 0 };
var keyCodeIsDefined = "keyCode" in aKeyEvent;
var keyCode =
(keyCodeIsDefined && aKeyEvent.keyCode >= 0 && aKeyEvent.keyCode <= 255) ?
aKeyEvent.keyCode : 0;
var keyName = "Unidentified";
if (aKey.indexOf("KEY_") == 0) {
keyName = aKey.substr("KEY_".length);
- result.flags |= Components.interfaces.nsITextInputProcessor.KEY_NON_PRINTABLE_KEY;
+ result.flags |= Ci.nsITextInputProcessor.KEY_NON_PRINTABLE_KEY;
} else if (aKey.indexOf("VK_") == 0) {
keyCode = _getKeyboardEvent(aWindow)["DOM_" + aKey];
if (!keyCode) {
throw "Unknown key: " + aKey;
}
keyName = _guessKeyNameFromKeyCode(keyCode, aWindow);
- result.flags |= Components.interfaces.nsITextInputProcessor.KEY_NON_PRINTABLE_KEY;
+ result.flags |= Ci.nsITextInputProcessor.KEY_NON_PRINTABLE_KEY;
} else if (aKey != "") {
keyName = aKey;
if (!keyCodeIsDefined) {
keyCode = _computeKeyCodeFromChar(aKey.charAt(0), aWindow);
}
if (!keyCode) {
- result.flags |= Components.interfaces.nsITextInputProcessor.KEY_KEEP_KEYCODE_ZERO;
+ result.flags |= Ci.nsITextInputProcessor.KEY_KEEP_KEYCODE_ZERO;
}
- result.flags |= Components.interfaces.nsITextInputProcessor.KEY_FORCE_PRINTABLE_KEY;
+ result.flags |= Ci.nsITextInputProcessor.KEY_FORCE_PRINTABLE_KEY;
}
var locationIsDefined = "location" in aKeyEvent;
if (locationIsDefined && aKeyEvent.location === 0) {
- result.flags |= Components.interfaces.nsITextInputProcessor.KEY_KEEP_KEY_LOCATION_STANDARD;
+ result.flags |= Ci.nsITextInputProcessor.KEY_KEEP_KEY_LOCATION_STANDARD;
}
result.dictionary = {
key: keyName,
code: "code" in aKeyEvent ? aKeyEvent.code : "",
location: locationIsDefined ? aKeyEvent.location : 0,
repeat: "repeat" in aKeyEvent ? aKeyEvent.repeat === true : false,
keyCode: keyCode,
};
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/httpd.js
+++ b/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/httpd.js
@@ -785,17 +785,17 @@ nsHttpServer.prototype =
delete this._connections[connection.number];
// Fire a pending server-stopped notification if it's our responsibility.
if (!this._hasOpenConnections() && this._socketClosed)
this._notifyStopped();
// Bug 508125: Add a GC here else we'll use gigabytes of memory running
// mochitests. We can't rely on xpcshell doing an automated GC, as that
// would interfere with testing GC stuff...
- Components.utils.forceGC();
+ Cu.forceGC();
},
/**
* Requests that the server be shut down when possible.
*/
_requestQuit: function()
{
dumpn(">>> requesting a quit");
--- a/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/os.js
+++ b/mail/test/resources/mozmill/mozmill/extension/resource/stdlib/os.js
@@ -39,25 +39,25 @@ var EXPORTED_SYMBOLS = ['listDirectory',
function listDirectory (file) {
// file is the given directory (nsIFile)
var entries = file.directoryEntries;
var array = [];
while (entries.hasMoreElements())
{
var entry = entries.getNext();
- entry.QueryInterface(Components.interfaces.nsIFile);
+ entry.QueryInterface(Ci.nsIFile);
array.push(entry);
}
return array;
}
function getFileForPath (path) {
- var file = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
file.initWithPath(path);
return file;
}
function abspath (rel, file) {
var relSplit = rel.split('/');
if (relSplit[0] == '..' && !file.isDirectory()) {
file = file.parent;
@@ -72,14 +72,14 @@ function abspath (rel, file) {
} else {
file.append(p);
}
}
return file.path;
}
function getPlatform () {
- var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULRuntime);
+ var xulRuntime = Cc["@mozilla.org/xre/app-info;1"]
+ .getService(Ci.nsIXULRuntime);
return xulRuntime.OS.toLowerCase();
}
--- a/mailnews/addrbook/content/abAddressBookNameDialog.js
+++ b/mailnews/addrbook/content/abAddressBookNameDialog.js
@@ -55,17 +55,17 @@ function abNameOnLoad()
}
function abNameOKButton()
{
var newName = gNameInput.value.trim();
// Do not allow an already existing name.
for (let ab of fixIterator(MailServices.ab.directories,
- Components.interfaces.nsIAbDirectory)) {
+ Ci.nsIAbDirectory)) {
if ((ab.dirName.toLowerCase() == newName.toLowerCase()) &&
(!gDirectory || (ab.URI != gDirectory.URI))) {
const kAlertTitle = document.getElementById("bundle_addressBook")
.getString("duplicateNameTitle");
const kAlertText = document.getElementById("bundle_addressBook")
.getFormattedString("duplicateNameText", [ab.dirName]);
Services.prompt.alert(window, kAlertTitle, kAlertText);
return false;
--- a/mailnews/addrbook/content/abDragDrop.js
+++ b/mailnews/addrbook/content/abDragDrop.js
@@ -3,40 +3,40 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
// Returns the load context for the current window
function getLoadContext() {
- return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsILoadContext);
+ return window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsILoadContext);
}
var abFlavorDataProvider = {
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIFlavorDataProvider]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIFlavorDataProvider]),
getFlavorData: function(aTransferable, aFlavor, aData, aDataLen)
{
if (aFlavor == "application/x-moz-file-promise")
{
var primitive = {};
aTransferable.getTransferData("text/vcard", primitive, {});
- var vCard = primitive.value.QueryInterface(Components.interfaces.nsISupportsString).data;
+ var vCard = primitive.value.QueryInterface(Ci.nsISupportsString).data;
aTransferable.getTransferData("application/x-moz-file-promise-dest-filename", primitive, {});
- var leafName = primitive.value.QueryInterface(Components.interfaces.nsISupportsString).data;
+ var leafName = primitive.value.QueryInterface(Ci.nsISupportsString).data;
aTransferable.getTransferData("application/x-moz-file-promise-dir", primitive, {});
- var localFile = primitive.value.QueryInterface(Components.interfaces.nsIFile).clone();
+ var localFile = primitive.value.QueryInterface(Ci.nsIFile).clone();
localFile.append(leafName);
- var ofStream = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
+ var ofStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
ofStream.init(localFile, -1, -1, 0);
- var converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"].createInstance(Components.interfaces.nsIConverterOutputStream);
+ var converter = Cc["@mozilla.org/intl/converter-output-stream;1"].createInstance(Ci.nsIConverterOutputStream);
converter.init(ofStream, null);
converter.writeString(vCard);
converter.close();
aData.value = localFile;
}
}
};
@@ -56,23 +56,23 @@ var abResultsPaneObserver = {
aXferData.data.addDataForFlavour("text/x-moz-address", selectedAddresses);
aXferData.data.addDataForFlavour("text/unicode", selectedAddresses);
let srcDirectory = getSelectedDirectory();
// The default allowable actions are copy, move and link, so we need
// to restrict them here.
if (!srcDirectory.readOnly)
// Only allow copy & move from read-write directories.
- aDragAction.action = Components.interfaces.
+ aDragAction.action = Ci.
nsIDragService.DRAGDROP_ACTION_COPY |
- Components.interfaces.
+ Ci.
nsIDragService.DRAGDROP_ACTION_MOVE;
else
// Only allow copy from read-only directories.
- aDragAction.action = Components.interfaces.
+ aDragAction.action = Ci.
nsIDragService.DRAGDROP_ACTION_COPY;
var card = GetSelectedCard();
if (card && card.displayName) {
let vCard = card.translateTo("vcard");
aXferData.data.addDataForFlavour("text/vcard", decodeURIComponent(vCard));
aXferData.data.addDataForFlavour("application/x-moz-file-promise-dest-filename", card.displayName + ".vcf");
aXferData.data.addDataForFlavour("application/x-moz-file-promise-url", "data:text/vcard," + vCard);
@@ -94,18 +94,18 @@ var abResultsPaneObserver = {
getSupportedFlavours: function ()
{
return null;
}
};
-var dragService = Components.classes["@mozilla.org/widget/dragservice;1"]
- .getService(Components.interfaces.nsIDragService);
+var dragService = Cc["@mozilla.org/widget/dragservice;1"]
+ .getService(Ci.nsIDragService);
var abDirTreeObserver = {
/**
* canDrop - determine if the tree will accept the dropping of a item
* onto it.
*
* Note 1: We don't allow duplicate mailing list names, therefore copy
* is not allowed for mailing lists.
@@ -125,17 +125,17 @@ var abDirTreeObserver = {
* (lists currently need to have unique names)
* card in mailing list -> parent mailing list = Not allowed
* card in mailing list -> other mailing list = MOVE or COPY
* card in mailing list -> other address book = MOVE or COPY
* read only directory item -> anywhere = COPY only
*/
canDrop: function(index, orientation, dataTransfer)
{
- if (orientation != Components.interfaces.nsITreeView.DROP_ON)
+ if (orientation != Ci.nsITreeView.DROP_ON)
return false;
if (!dataTransfer.types.includes("moz/abcard")) {
return false;
}
let targetURI = gDirectoryTreeView.getDirectoryAtIndex(index).URI;
let srcURI = getSelectedDirectoryURI();
@@ -173,17 +173,17 @@ var abDirTreeObserver = {
// dragSession.dragAction != Components.interfaces.
// nsIDragService.DRAGDROP_ACTION_COPY)
//return false;
var srcDirectory = GetDirectoryFromURI(srcURI);
// Only allow copy from read-only directories.
if (srcDirectory.readOnly &&
- dragSession.dragAction != Components.interfaces.
+ dragSession.dragAction != Ci.
nsIDragService.DRAGDROP_ACTION_COPY)
return false;
// Go through the cards checking to see if one of them is a mailing list
// (if we are attempting a copy) - we can't copy mailing lists as
// that would give us duplicate names which isn't allowed at the
// moment.
var draggingMailList = false;
@@ -199,17 +199,17 @@ var abDirTreeObserver = {
break;
}
}
// The rest of the cases - allow cards for copy or move, but only allow
// move of mailing lists if we're not going into another mailing list.
if (draggingMailList &&
(targetDirectory.isMailList ||
- dragSession.dragAction == Components.interfaces.
+ dragSession.dragAction == Ci.
nsIDragService.DRAGDROP_ACTION_COPY))
{
return false;
}
dragSession.canDrop = true;
return true;
},
@@ -286,18 +286,18 @@ var abDirTreeObserver = {
srcDirectory = MailServices.ab.getDirectoryFromId(dirId);
}
directory.dropCard(card, needToCopyCard);
// This is true only if srcURI is "All ABs" and action is moving.
if (srcDirectory) {
let cardArray =
- Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
cardArray.appendElement(card);
srcDirectory.deleteCards(cardArray);
}
}
}
var cardsTransferredText;
@@ -354,18 +354,18 @@ var abDirTreeObserver = {
function DragAddressOverTargetControl(event)
{
var dragSession = gDragService.getCurrentSession();
if (!dragSession.isDataFlavorSupported("text/x-moz-address"))
return;
- var trans = Components.classes["@mozilla.org/widget/transferable;1"]
- .createInstance(Components.interfaces.nsITransferable);
+ var trans = Cc["@mozilla.org/widget/transferable;1"]
+ .createInstance(Ci.nsITransferable);
trans.init(getLoadContext());
trans.addDataFlavor("text/x-moz-address");
var canDrop = true;
for ( var i = 0; i < dragSession.numDropItems; ++i )
{
dragSession.getData ( trans, i );
@@ -384,17 +384,17 @@ function DragAddressOverTargetControl(ev
}
dragSession.canDrop = canDrop;
}
function DropAddressOverTargetControl(event)
{
var dragSession = gDragService.getCurrentSession();
- var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
+ var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
trans.addDataFlavor("text/x-moz-address");
for ( var i = 0; i < dragSession.numDropItems; ++i )
{
dragSession.getData ( trans, i );
var dataObj = new Object();
var bestFlavor = new Object();
var len = new Object();
@@ -405,17 +405,17 @@ function DropAddressOverTargetControl(ev
trans.getAnyTransferData ( bestFlavor, dataObj, len);
}
catch (ex)
{
continue;
}
if ( dataObj )
- dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsString);
+ dataObj = dataObj.value.QueryInterface(Ci.nsISupportsString);
if ( !dataObj )
continue;
// pull the address out of the data object
var address = dataObj.data.substring(0, len.value);
if (!address)
continue;
--- a/mailnews/addrbook/content/abMailListDialog.js
+++ b/mailnews/addrbook/content/abMailListDialog.js
@@ -8,28 +8,28 @@ var inputElementType = "";
var gListCard;
var gEditList;
var oldListName = "";
var gLoadListeners = [];
var gSaveListeners = [];
try
{
- var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"]
- .getService(Components.interfaces.nsIDragService);
+ var gDragService = Cc["@mozilla.org/widget/dragservice;1"]
+ .getService(Ci.nsIDragService);
}
catch (e)
{
}
// Returns the load context for the current window
function getLoadContext() {
- return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsILoadContext);
+ return window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsILoadContext);
}
function awHandleKeyPress(element, event)
{
// allow dialog to close on enter if focused textbox has no value
if (element.value != "" && event.keyCode == KeyEvent.DOM_VK_RETURN) {
event.stopPropagation();
event.preventDefault();
@@ -84,19 +84,19 @@ function GetListValue(mailList, doAdd)
var pos = 0;
var inputField, fieldValue, cardproperty;
while ((inputField = awGetInputElement(i)))
{
fieldValue = inputField.value;
if (doAdd || (!doAdd && pos >= oldTotal))
- cardproperty = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance();
+ cardproperty = Cc["@mozilla.org/addressbook/cardproperty;1"].createInstance();
else
- cardproperty = mailList.addressLists.queryElementAt(pos, Components.interfaces.nsIAbCard);
+ cardproperty = mailList.addressLists.queryElementAt(pos, Ci.nsIAbCard);
if (fieldValue == "")
{
if (!doAdd && cardproperty)
try
{
mailList.addressLists.removeElementAt(pos);
--oldTotal;
@@ -105,27 +105,27 @@ function GetListValue(mailList, doAdd)
{
// Ignore attempting to remove an item
// at a position greater than the number
// of elements in the addressLists attribute
}
}
else if (cardproperty)
{
- cardproperty = cardproperty.QueryInterface(Components.interfaces.nsIAbCard);
+ cardproperty = cardproperty.QueryInterface(Ci.nsIAbCard);
if (cardproperty)
{
let addrObjects = MailServices.headerParser
.makeFromDisplayAddress(fieldValue, {});
for (let j = 0; j < addrObjects.length; j++)
{
if (j > 0)
{
- cardproperty = Components.classes["@mozilla.org/addressbook/cardproperty;1"].createInstance();
- cardproperty = cardproperty.QueryInterface(Components.interfaces.nsIAbCard);
+ cardproperty = Cc["@mozilla.org/addressbook/cardproperty;1"].createInstance();
+ cardproperty = cardproperty.QueryInterface(Ci.nsIAbCard);
}
cardproperty.primaryEmail = addrObjects[j].email;
cardproperty.displayName = addrObjects[j].name || addrObjects[j].email;
if (doAdd || (doAdd == false && pos >= oldTotal))
mailList.addressLists.appendElement(cardproperty);
}
pos++;
@@ -153,18 +153,18 @@ function MailListOKButton()
// FIX ME - hack to avoid crashing if no ab selected because of blank option bug from template
// should be able to just remove this if we are not seeing blank lines in the ab popup
if (!uri)
return false; // don't close window
// -----
//Add mailing list to database
- var mailList = Components.classes["@mozilla.org/addressbook/directoryproperty;1"].createInstance();
- mailList = mailList.QueryInterface(Components.interfaces.nsIAbDirectory);
+ var mailList = Cc["@mozilla.org/addressbook/directoryproperty;1"].createInstance();
+ mailList = mailList.QueryInterface(Ci.nsIAbDirectory);
if (GetListValue(mailList, true))
{
var parentDirectory = GetDirectoryFromURI(uri);
mailList = parentDirectory.addMailList(mailList);
NotifySaveListeners(mailList);
}
else
@@ -266,17 +266,17 @@ function OnLoadEditList()
{
let listbox = document.getElementById('addressingWidget');
let newListBoxNode = listbox.cloneNode(false);
let templateNode = listbox.querySelector("listitem");
top.MAX_RECIPIENTS = 0;
for (let i = 0; i < total; i++)
{
- let card = gEditList.addressLists.queryElementAt(i, Components.interfaces.nsIAbCard);
+ let card = gEditList.addressLists.queryElementAt(i, Ci.nsIAbCard);
let address = MailServices.headerParser.makeMailboxObject(
card.displayName, card.primaryEmail).toString();
SetInputValue(address, newListBoxNode, templateNode);
}
listbox.parentNode.replaceChild(newListBoxNode, listbox);
}
}
@@ -501,33 +501,33 @@ function DragOverAddressListTree(event)
}
function DropOnAddressListTree(event)
{
let dragSession = gDragService.getCurrentSession();
let trans;
try {
- trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
+ trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
trans.init(getLoadContext());
trans.addDataFlavor("text/x-moz-address");
}
catch (ex) {
return;
}
for (let i = 0; i < dragSession.numDropItems; ++i)
{
dragSession.getData(trans, i);
let dataObj = new Object();
let bestFlavor = new Object();
let len = new Object();
trans.getAnyTransferData(bestFlavor, dataObj, len);
if (dataObj)
- dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsString);
+ dataObj = dataObj.value.QueryInterface(Ci.nsISupportsString);
if (!dataObj)
continue;
// pull the URL out of the data object
let address = dataObj.data.substring(0, len.value);
if (!address)
continue;
--- a/mailnews/addrbook/content/abResultsPane.js
+++ b/mailnews/addrbook/content/abResultsPane.js
@@ -65,24 +65,24 @@ function SetAbView(aURI)
var sortColumnNode = document.getElementById(sortColumn);
if (sortColumnNode && sortColumnNode.hasAttribute("sortDirection"))
sortDirection = sortColumnNode.getAttribute("sortDirection");
}
var directory = GetDirectoryFromURI(aURI);
if (!gAbView)
- gAbView = Components.classes["@mozilla.org/addressbook/abview;1"]
- .createInstance(Components.interfaces.nsIAbView);
+ gAbView = Cc["@mozilla.org/addressbook/abview;1"]
+ .createInstance(Ci.nsIAbView);
var actualSortColumn = gAbView.setView(directory, GetAbViewListener(),
sortColumn, sortDirection);
gAbResultsTree.treeBoxObject.view =
- gAbView.QueryInterface(Components.interfaces.nsITreeView);
+ gAbView.QueryInterface(Ci.nsITreeView);
UpdateSortIndicators(actualSortColumn, sortDirection);
// If the selected address book is LDAP and the search box is empty,
// inform the user of the empty results pane.
let abResultsTree = document.getElementById("abResultsTree");
let cardViewOuterBox = document.getElementById("CardViewOuterBox");
let blankResultsPaneMessageBox = document.getElementById("blankResultsPaneMessageBox");
@@ -130,17 +130,17 @@ function GetNumSelectedCards()
// if something went wrong, return 0 for the count.
return 0;
}
function GetSelectedCardTypes()
{
var cards = GetSelectedAbCards();
if (!cards) {
- Components.utils.reportError("ERROR: GetSelectedCardTypes: |cards| is null.");
+ Cu.reportError("ERROR: GetSelectedCardTypes: |cards| is null.");
return kNothingSelected; // no view
}
var count = cards.length;
if (count == 0)
return kNothingSelected; // nothing selected
var mailingListCnt = 0;
var cardCnt = 0;
--- a/mailnews/addrbook/content/addrbookWidgets.xml
+++ b/mailnews/addrbook/content/addrbookWidgets.xml
@@ -24,17 +24,17 @@
<![CDATA[
ChromeUtils.import("resource:///modules/mailServices.js", this);
ChromeUtils.import("resource:///modules/iteratorUtils.jsm", this);
ChromeUtils.import("resource:///modules/StringBundle.js", this);
this._stringBundle = new this
.StringBundle("chrome://messenger/locale/addressbook/addressBook.properties");
this._rebuild();
- const nsIAbListener = Components.interfaces.nsIAbListener;
+ const nsIAbListener = Ci.nsIAbListener;
// Add a listener so we can update correctly if the list should change
this.MailServices.ab
.addAddressBookListener(this,
nsIAbListener.itemAdded |
nsIAbListener.directoryItemRemoved |
nsIAbListener.directoryRemoved |
nsIAbListener.itemChanged);
]]>
@@ -48,25 +48,25 @@
]]>
</destructor>
<method name="_rebuild">
<parameter name="aSelectValue"/>
<body><![CDATA[
// Init the address book cache.
this._directories.length = 0;
- const nsIAbDirectory = Components.interfaces.nsIAbDirectory;
+ const nsIAbDirectory = Ci.nsIAbDirectory;
let directories = this.MailServices.ab.directories;
while (directories && directories.hasMoreElements()) {
let ab = directories.getNext();
if ((ab instanceof nsIAbDirectory) && this._matches(ab)) {
this._directories.push(ab);
if (this.getAttribute("mailinglists") == "true") {
// Also append contained mailinglists.
- for (let list of this.fixIterator(ab.childNodes, Components.interfaces.nsIAbDirectory)) {
+ for (let list of this.fixIterator(ab.childNodes, Ci.nsIAbDirectory)) {
if (this._matches(list))
this._directories.push(list);
}
}
}
}
this._sort();
@@ -131,28 +131,28 @@
</method>
<!-- nsIAbListener methods -->
<method name="onItemAdded">
<parameter name="aParentDir"/>
<parameter name="aItem"/>
<body><![CDATA[
// Are we interested in this new directory?
- if (aItem instanceof Components.interfaces.nsIAbDirectory &&
+ if (aItem instanceof Ci.nsIAbDirectory &&
this._matches(aItem)) {
this._rebuild();
}
]]></body>
</method>
<method name="onItemRemoved">
<parameter name="aParentDir"/>
<parameter name="aItem"/>
<body><![CDATA[
- if (aItem instanceof Components.interfaces.nsIAbDirectory) {
+ if (aItem instanceof Ci.nsIAbDirectory) {
// Find the item in the list to remove.
// We can't use indexOf here because we need loose equality.
for (var index = this._directories.length; --index >= 0; )
if (this._directories[index] == aItem)
break;
if (index != -1) {
this._directories.splice(index, 1);
// Are we removing the selected directory?
@@ -170,17 +170,17 @@
</method>
<method name="onItemPropertyChanged">
<parameter name="aItem"/>
<parameter name="aProperty"/>
<parameter name="aOldValue"/>
<parameter name="aNewValue"/>
<body><![CDATA[
- if (aItem instanceof Components.interfaces.nsIAbDirectory) {
+ if (aItem instanceof Ci.nsIAbDirectory) {
// Find the item in the list to rename.
// We can't use indexOf here because we need loose equality.
for (var oldIndex = this._directories.length; --oldIndex >= 0; )
if (this._directories[oldIndex] == aItem)
break;
if (oldIndex != -1)
this._rebuild();
}
@@ -371,21 +371,21 @@
@param aIndex The index of the service to return. 0 is the default service.
-->
<method name="_getMapURLPref">
<parameter name="aIndex"/>
<body><![CDATA[
let url = null;
if (!aIndex) {
url = Services.prefs.getComplexValue("mail.addr_book.mapit_url.format",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
} else {
try {
url = Services.prefs.getComplexValue("mail.addr_book.mapit_url." + aIndex + ".format",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
} catch (e) { }
}
return url;
]]></body>
</method>
<!--
@@ -427,17 +427,17 @@
let urlName;
let urlTemplate = this._getMapURLPref(index);
if (!urlTemplate) {
itemFound = false;
} else {
// Name is not mandatory, generate one if not found.
try {
urlName = Services.prefs.getComplexValue("mail.addr_book.mapit_url." + index + ".name",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
} catch (e) {
urlName = generateName(urlTemplate);
}
}
if (itemFound) {
addMapService(urlTemplate, urlName);
index++;
if (urlTemplate == defaultUrl)
@@ -465,21 +465,21 @@
<!--
Save user selected mapping service.
@param aItem The chosen menuitem with map service.
-->
<method name="_chooseMapService">
<parameter name="aItem"/>
<body><![CDATA[
// Save selected URL as the default.
- let defaultUrl = Components.classes["@mozilla.org/pref-localizedstring;1"]
- .createInstance(Components.interfaces.nsIPrefLocalizedString);
+ let defaultUrl = Cc["@mozilla.org/pref-localizedstring;1"]
+ .createInstance(Ci.nsIPrefLocalizedString);
defaultUrl.data = aItem.getAttribute("url");
Services.prefs.setComplexValue("mail.addr_book.mapit_url.format",
- Components.interfaces.nsIPrefLocalizedString, defaultUrl);
+ Ci.nsIPrefLocalizedString, defaultUrl);
]]></body>
</method>
<!--
Generate map URL in the href attribute.
-->
<method name="_createMapItURL">
<body><![CDATA[
--- a/mailnews/addrbook/prefs/content/pref-directory-add.js
+++ b/mailnews/addrbook/prefs/content/pref-directory-add.js
@@ -7,18 +7,18 @@
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource:///modules/hostnameUtils.jsm");
ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
var gCurrentDirectory = null;
var gReplicationBundle = null;
var gReplicationService =
- Components.classes["@mozilla.org/addressbook/ldap-replication-service;1"].
- getService(Components.interfaces.nsIAbLDAPReplicationService);
+ Cc["@mozilla.org/addressbook/ldap-replication-service;1"].
+ getService(Ci.nsIAbLDAPReplicationService);
var gReplicationCancelled = false;
var gProgressText;
var gProgressMeter;
var gDownloadInProgress = false;
var kDefaultMaxHits = 100;
var kDefaultLDAPPort = 389;
var kDefaultSecureLDAPPort = 636;
@@ -82,30 +82,30 @@ function onUnload()
Services.obs.removeObserver(ldapOfflineObserver,
"network:offline-status-changed");
}
}
var progressListener = {
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus)
{
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_START) {
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
// start the spinning
gProgressMeter.setAttribute("mode", "undetermined");
gProgressText.value = gReplicationBundle.getString(aStatus ?
"replicationStarted" :
"changesStarted");
gDownloadInProgress = true;
document.getElementById("download").label =
gReplicationBundle.getString("cancelDownloadButton");
document.getElementById("download").accessKey =
gReplicationBundle.getString("cancelDownloadButton.accesskey");
}
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) {
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
EndDownload(aStatus);
}
},
onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
{
gProgressText.value = gReplicationBundle.getFormattedString("currentCount",
[aCurSelfProgress]);
},
@@ -115,36 +115,36 @@ var progressListener = {
onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage)
{
},
onSecurityChange: function(aWebProgress, aRequest, state)
{
},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIWebProgressListener) ||
- iid.equals(Components.interfaces.nsISupportsWeakReference) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIWebProgressListener) ||
+ iid.equals(Ci.nsISupportsWeakReference) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
};
function DownloadNow()
{
if (!gDownloadInProgress) {
gProgressText = document.getElementById("replicationProgressText");
gProgressMeter = document.getElementById("replicationProgressMeter");
gProgressText.hidden = false;
gProgressMeter.hidden = false;
gReplicationCancelled = false;
try {
- if (gCurrentDirectory instanceof Components.interfaces.nsIAbLDAPDirectory)
+ if (gCurrentDirectory instanceof Ci.nsIAbLDAPDirectory)
gReplicationService.startReplication(gCurrentDirectory,
progressListener);
else
EndDownload(false);
}
catch (ex) {
EndDownload(false);
}
@@ -181,28 +181,28 @@ function EndDownload(aStatus)
}
// fill the settings panel with the data from the preferences.
//
function fillSettings()
{
document.getElementById("description").value = gCurrentDirectory.dirName;
- if (gCurrentDirectory instanceof Components.interfaces.nsIAbLDAPDirectory) {
+ if (gCurrentDirectory instanceof Ci.nsIAbLDAPDirectory) {
var ldapUrl = gCurrentDirectory.lDAPURL;
document.getElementById("results").value = gCurrentDirectory.maxHits;
document.getElementById("login").value = gCurrentDirectory.authDn;
document.getElementById("hostname").value = ldapUrl.host;
document.getElementById("basedn").value = ldapUrl.dn;
document.getElementById("search").value = ldapUrl.filter;
var sub = document.getElementById("sub");
switch(ldapUrl.scope) {
- case Components.interfaces.nsILDAPURL.SCOPE_ONELEVEL:
+ case Ci.nsILDAPURL.SCOPE_ONELEVEL:
sub.radioGroup.selectedItem = document.getElementById("one");
break;
default:
sub.radioGroup.selectedItem = sub;
break;
}
var sasl = document.getElementById("saslMechanism");
@@ -296,17 +296,17 @@ function onAccept()
let results = document.getElementById("results").value;
let errorValue = null;
let errorArg = null;
let saslMechanism = "";
let findDupeName = function(newName) {
// Do not allow an already existing name.
for (let ab of fixIterator(MailServices.ab.directories,
- Components.interfaces.nsIAbDirectory)) {
+ Ci.nsIAbDirectory)) {
if ((ab.dirName.toLowerCase() == newName.toLowerCase()) &&
(!gCurrentDirectory || (ab.URI != gCurrentDirectory.URI))) {
return ab.dirName;
}
}
return null;
};
@@ -323,50 +323,50 @@ function onAccept()
else if (results && hasCharacters(results))
errorValue = "invalidResults";
if (!errorValue) {
// XXX Due to the LDAP c-sdk pass a dummy url to the IO service, then
// update the parts (bug 473351).
let ldapUrl = Services.io.newURI(
(secure.checked ? "ldaps://" : "ldap://") + "localhost/dc=???")
- .QueryInterface(Components.interfaces.nsILDAPURL);
+ .QueryInterface(Ci.nsILDAPURL);
ldapUrl.host = hostname;
ldapUrl.port = port ? port :
(secure.checked ? kDefaultSecureLDAPPort :
kDefaultLDAPPort);
ldapUrl.dn = document.getElementById("basedn").value;
ldapUrl.scope = document.getElementById("one").selected ?
- Components.interfaces.nsILDAPURL.SCOPE_ONELEVEL :
- Components.interfaces.nsILDAPURL.SCOPE_SUBTREE;
+ Ci.nsILDAPURL.SCOPE_ONELEVEL :
+ Ci.nsILDAPURL.SCOPE_SUBTREE;
ldapUrl.filter = document.getElementById("search").value;
if (document.getElementById("GSSAPI").selected) {
saslMechanism = "GSSAPI";
}
// check if we are modifying an existing directory or adding a new directory
if (gCurrentDirectory) {
gCurrentDirectory.dirName = description;
- gCurrentDirectory.lDAPURL = ldapUrl.QueryInterface(Components.interfaces.nsILDAPURL);
+ gCurrentDirectory.lDAPURL = ldapUrl.QueryInterface(Ci.nsILDAPURL);
window.opener.gNewServerString = gCurrentDirectory.dirPrefId;
}
else { // adding a new directory
window.opener.gNewServerString =
MailServices.ab.newAddressBook(description, ldapUrl.spec, kLDAPDirectory);
}
// XXX This is really annoying - both new/modify Address Book don't
// give us back the new directory we just created - so go find it from
// rdf so we can set a few final things up on it.
var targetURI = "moz-abldapdirectory://" + window.opener.gNewServerString;
var theDirectory =
MailServices.ab.getDirectory(targetURI)
- .QueryInterface(Components.interfaces.nsIAbLDAPDirectory);
+ .QueryInterface(Ci.nsIAbLDAPDirectory);
theDirectory.maxHits = results;
theDirectory.authDn = document.getElementById("login").value;
theDirectory.saslMechanism = saslMechanism;
window.opener.gNewServer = description;
// set window.opener.gUpdate to true so that LDAP Directory Servers
// dialog gets updated
@@ -379,17 +379,17 @@ function onAccept()
errorText = addressBookBundle.getFormattedString(errorValue, [errorArg])
else
errorText = addressBookBundle.getString(errorValue);
Services.prompt.alert(window, document.title, errorText);
return false;
}
} catch (outer) {
- Components.utils.reportError("Internal error in pref-directory-add.js:onAccept() " + outer);
+ Cu.reportError("Internal error in pref-directory-add.js:onAccept() " + outer);
}
return true;
}
function onCancel()
{
window.opener.gUpdate = false;
}
--- a/mailnews/addrbook/prefs/content/pref-editdirectories.js
+++ b/mailnews/addrbook/prefs/content/pref-editdirectories.js
@@ -6,27 +6,27 @@
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
// Listener to refresh the list items if something changes. In all these
// cases we just rebuild the list as it is easier than searching/adding in the
// correct places an would be an infrequent operation.
var gAddressBookAbListener = {
onItemAdded: function(parentDir, item) {
- if (item instanceof Components.interfaces.nsIAbDirectory) {
+ if (item instanceof Ci.nsIAbDirectory) {
fillDirectoryList();
}
},
onItemRemoved: function(parentDir, item) {
- if (item instanceof Components.interfaces.nsIAbDirectory) {
+ if (item instanceof Ci.nsIAbDirectory) {
fillDirectoryList();
}
},
onItemPropertyChanged: function(item, property, oldValue, newValue) {
- if (item instanceof Components.interfaces.nsIAbDirectory) {
+ if (item instanceof Ci.nsIAbDirectory) {
fillDirectoryList();
}
}
};
function onInitEditDirectories()
{
// For AbDeleteDirectory in abCommon.js
@@ -34,17 +34,17 @@ function onInitEditDirectories()
// If the pref is locked disable the "Add" button
if (Services.prefs.prefIsLocked("ldap_2.disable_button_add"))
document.getElementById("addButton").setAttribute('disabled', true);
// Fill out the directory list
fillDirectoryList();
- const nsIAbListener = Components.interfaces.nsIAbListener;
+ const nsIAbListener = Ci.nsIAbListener;
// Add a listener so we can update correctly if the list should change
MailServices.ab.addAddressBookListener(gAddressBookAbListener,
nsIAbListener.itemAdded |
nsIAbListener.directoryRemoved |
nsIAbListener.itemChanged);
}
function onUninitEditDirectories()
@@ -60,17 +60,17 @@ function fillDirectoryList()
while (abList.hasChildNodes())
abList.lastChild.remove();
// Init the address book list
let directories = MailServices.ab.directories;
let holdingArray = [];
while (directories && directories.hasMoreElements()) {
let ab = directories.getNext();
- if (ab instanceof Components.interfaces.nsIAbDirectory && ab.isRemote)
+ if (ab instanceof Ci.nsIAbDirectory && ab.isRemote)
holdingArray.push(ab);
}
holdingArray.sort(function (a, b) { return a.dirName.localeCompare(b.dirName); });
holdingArray.forEach(function (ab) {
var item = document.createElement('listitem');
item.setAttribute("label", ab.dirName);
--- a/mailnews/addrbook/src/nsAbAutoCompleteMyDomain.js
+++ b/mailnews/addrbook/src/nsAbAutoCompleteMyDomain.js
@@ -5,27 +5,27 @@
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
function nsAbAutoCompleteMyDomain() {}
nsAbAutoCompleteMyDomain.prototype = {
classID: Components.ID("{5b259db2-e451-4de9-8a6f-cfba91402973}"),
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsIAutoCompleteSearch]),
+ Ci.nsIAutoCompleteSearch]),
cachedIdKey: "",
cachedIdentity: null,
applicableHeaders: new Set(["addr_to", "addr_cc", "addr_bcc", "addr_reply"]),
startSearch: function(aString, aSearchParam, aResult, aListener) {
let params = aSearchParam ? JSON.parse(aSearchParam) : {};
let applicable = ("type" in params) && this.applicableHeaders.has(params.type);
- const ACR = Components.interfaces.nsIAutoCompleteResult;
+ const ACR = Ci.nsIAutoCompleteResult;
var address = null;
if (applicable && aString && !aString.includes(",")) {
if (("idKey" in params) && (params.idKey != this.cachedIdKey)) {
this.cachedIdentity = MailServices.accounts.getIdentity(params.idKey);
this.cachedIdKey = params.idKey;
}
if (this.cachedIdentity.autocompleteToMyDomain)
address = aString.includes("@") ? aString :
--- a/mailnews/addrbook/src/nsAbAutoCompleteSearch.js
+++ b/mailnews/addrbook/src/nsAbAutoCompleteSearch.js
@@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource:///modules/ABQueryUtils.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-var ACR = Components.interfaces.nsIAutoCompleteResult;
-var nsIAbAutoCompleteResult = Components.interfaces.nsIAbAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
+var nsIAbAutoCompleteResult = Ci.nsIAbAutoCompleteResult;
function nsAbAutoCompleteResult(aSearchString) {
// Can't create this in the prototype as we'd get the same array for
// all instances
this._searchResults = []; // final results
this.searchString = aSearchString;
this._collectedValues = new Map(); // temporary unsorted results
// Get model query from pref; this will return mail.addr_book.autocompletequery.format.phonetic
@@ -119,17 +119,17 @@ nsAbAutoCompleteSearch.prototype = {
// Now store this change so that we're not changing it each time around.
if (!aDirectory.readOnly) {
aCard.setProperty("PopularityIndex", popularityIndex);
try {
aDirectory.modifyCard(aCard);
}
catch (ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
}
}
return popularityIndex;
},
/**
* Gets the score of the (full) address, given the search input. We want
@@ -184,28 +184,28 @@ nsAbAutoCompleteSearch.prototype = {
* @param directory An nsIAbDirectory to search.
* @param result The result element to append results to.
*/
_searchCards: function(searchQuery, directory, result) {
let childCards;
try {
childCards = this._abManager.getDirectory(directory.URI + searchQuery).childCards;
} catch (e) {
- Components.utils.reportError("Error running addressbook query '" + searchQuery + "': " + e);
+ Cu.reportError("Error running addressbook query '" + searchQuery + "': " + e);
return;
}
// Cache this values to save going through xpconnect each time
var commentColumn = this._commentColumn == 1 ? directory.dirName : "";
// Now iterate through all the cards.
while (childCards.hasMoreElements()) {
var card = childCards.getNext();
- if (card instanceof Components.interfaces.nsIAbCard) {
+ if (card instanceof Ci.nsIAbCard) {
if (card.isMailList)
this._addToResult(commentColumn, directory, card, "", true, result);
else {
let email = card.primaryEmail;
if (email)
this._addToResult(commentColumn, directory, card, email, true, result);
email = card.getProperty("SecondEmail", "");
@@ -417,17 +417,17 @@ nsAbAutoCompleteSearch.prototype = {
let allABs = this._abManager.directories;
// We're not going to bother searching sub-directories, currently the
// architecture forces all cards that are in mailing lists to be in ABs as
// well, therefore by searching sub-directories (aka mailing lists) we're
// just going to find duplicates.
while (allABs.hasMoreElements()) {
let dir = allABs.getNext();
- if (dir instanceof Components.interfaces.nsIAbDirectory &&
+ if (dir instanceof Ci.nsIAbDirectory &&
dir.useForAutocomplete(("idKey" in params) ? params.idKey : null)) {
this._searchCards(searchQuery, dir, result);
}
}
result._searchResults = [...result._collectedValues.values()];
}
@@ -451,16 +451,15 @@ nsAbAutoCompleteSearch.prototype = {
aListener.onSearchResult(this, result);
},
stopSearch: function stopSearch() {
},
// nsISupports
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces
- .nsIAutoCompleteSearch])
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteSearch])
};
// Module
var components = [nsAbAutoCompleteSearch];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/mailnews/addrbook/src/nsAbLDAPAttributeMap.js
+++ b/mailnews/addrbook/src/nsAbLDAPAttributeMap.js
@@ -27,17 +27,17 @@ nsAbLDAPAttributeMap.prototype = {
// return the joined list
return this.mPropertyMap[aProperty].join(",");
},
getAttributes: function getAttributes(aProperty, aCount, aAttrs) {
// fail if no entry for this
if (!(aProperty in this.mPropertyMap)) {
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
}
aAttrs = this.mPropertyMap[aProperty];
aCount = aAttrs.length;
return aAttrs;
},
getFirstAttribute: function getFirstAttribute(aProperty) {
@@ -55,17 +55,17 @@ nsAbLDAPAttributeMap.prototype = {
var attrs = aAttributeList.split(",");
// check to make sure this call won't allow multiple mappings to be
// created, if requested
if (!aAllowInconsistencies) {
for (var attr of attrs) {
if (attr in this.mAttrMap && this.mAttrMap[attr] != aProperty) {
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
}
}
}
// delete any attr mappings created by the existing property map entry
if (aProperty in this.mPropertyMap) {
for (attr of this.mPropertyMap[aProperty]) {
delete this.mAttrMap[attr];
@@ -93,17 +93,17 @@ nsAbLDAPAttributeMap.prototype = {
getAllCardAttributes: function getAllCardAttributes() {
var attrs = [];
for (var prop in this.mPropertyMap) {
let attrArray = this.mPropertyMap[prop];
attrs = attrs.concat(attrArray);
}
if (!attrs.length) {
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
}
return attrs.join(",");
},
getAllCardProperties: function getAllCardProperties(aCount) {
var props = [];
@@ -170,17 +170,17 @@ nsAbLDAPAttributeMap.prototype = {
} catch (ex) {
// ignore any errors getting message values or setting card values
}
}
}
}
if (!cardValueWasSet) {
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
}
return;
},
checkState: function checkState() {
var attrsSeen = [];
@@ -191,29 +191,29 @@ nsAbLDAPAttributeMap.prototype = {
// multiple attributes that mapped to the empty string are permitted
if (!attr.length) {
continue;
}
// if we've seen this before, there's a problem
if (attrsSeen.indexOf(attr) != -1) {
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
}
// remember that we've seen it now
attrsSeen.push(attr);
}
}
return;
},
QueryInterface: XPCOMUtils
- .generateQI([Components.interfaces.nsIAbLDAPAttributeMap])
+ .generateQI([Ci.nsIAbLDAPAttributeMap])
}
function nsAbLDAPAttributeMapService() {
}
nsAbLDAPAttributeMapService.prototype = {
classID: NS_ABLDAPATTRIBUTEMAPSERVICE_CID,
@@ -235,13 +235,13 @@ nsAbLDAPAttributeMapService.prototype =
// cache
this.mAttrMaps[aPrefBranchName] = attrMap;
// and return
return attrMap;
},
QueryInterface: XPCOMUtils
- .generateQI([Components.interfaces.nsIAbLDAPAttributeMapService])
+ .generateQI([Ci.nsIAbLDAPAttributeMapService])
}
var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsAbLDAPAttributeMap, nsAbLDAPAttributeMapService]);
--- a/mailnews/addrbook/src/nsAbLDAPAutoCompleteSearch.js
+++ b/mailnews/addrbook/src/nsAbLDAPAutoCompleteSearch.js
@@ -2,20 +2,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-var ACR = Components.interfaces.nsIAutoCompleteResult;
-var nsIAbAutoCompleteResult = Components.interfaces.nsIAbAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
+var nsIAbAutoCompleteResult = Ci.nsIAbAutoCompleteResult;
var nsIAbDirectoryQueryResultListener =
- Components.interfaces.nsIAbDirectoryQueryResultListener;
+ Ci.nsIAbDirectoryQueryResultListener;
// nsAbLDAPAutoCompleteResult
// Derived from nsIAbAutoCompleteResult, provides a LDAP specific result
// implementation.
function nsAbLDAPAutoCompleteResult(aSearchString) {
// Can't create this in the prototype as we'd get the same array for
// all instances
@@ -74,18 +74,18 @@ nsAbLDAPAutoCompleteResult.prototype = {
// nsISupports
QueryInterface: XPCOMUtils.generateQI([ACR, nsIAbAutoCompleteResult])
}
function nsAbLDAPAutoCompleteSearch() {
Services.obs.addObserver(this, "quit-application");
- this._timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ this._timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
}
nsAbLDAPAutoCompleteSearch.prototype = {
// For component registration
classID: Components.ID("227e6482-fe9f-441f-9b7d-7b60375e7449"),
// A short-lived LDAP directory cache.
// To avoid recreating components as the user completes, we maintain the most
@@ -189,18 +189,18 @@ nsAbLDAPAutoCompleteSearch.prototype = {
var acDirURI = null;
var identity;
if ("idKey" in params) {
try {
identity = MailServices.accounts.getIdentity(params.idKey);
}
catch(ex) {
- Components.utils.reportError("Couldn't get specified identity, " +
- "falling back to global settings");
+ Cu.reportError("Couldn't get specified identity, " +
+ "falling back to global settings");
}
}
// Does the current identity override the global preference?
if (identity && identity.overrideGlobalPref)
acDirURI = identity.directoryServer;
else {
// Try the global one
@@ -215,48 +215,48 @@ nsAbLDAPAutoCompleteSearch.prototype = {
}
this.stopSearch();
// If we don't already have a cached query for this URI, build a new one.
acDirURI = "moz-abldapdirectory://" + acDirURI;
if (!this._book || this._book.URI != acDirURI) {
this._query =
- Components.classes["@mozilla.org/addressbook/ldap-directory-query;1"]
- .createInstance(Components.interfaces.nsIAbDirectoryQuery);
+ Cc["@mozilla.org/addressbook/ldap-directory-query;1"]
+ .createInstance(Ci.nsIAbDirectoryQuery);
this._book = MailServices.ab.getDirectory(acDirURI)
- .QueryInterface(Components.interfaces.nsIAbLDAPDirectory);
+ .QueryInterface(Ci.nsIAbLDAPDirectory);
// Create a minimal map just for the display name and primary email.
this._attributes =
- Components.classes["@mozilla.org/addressbook/ldap-attribute-map;1"]
- .createInstance(Components.interfaces.nsIAbLDAPAttributeMap);
+ Cc["@mozilla.org/addressbook/ldap-attribute-map;1"]
+ .createInstance(Ci.nsIAbLDAPAttributeMap);
this._attributes.setAttributeList("DisplayName",
this._book.attributeMap.getAttributeList("DisplayName", {}), true);
this._attributes.setAttributeList("PrimaryEmail",
this._book.attributeMap.getAttributeList("PrimaryEmail", {}), true);
}
this._result._commentColumn = this._book.dirName;
this._listener = aListener;
- this._timer.init(this, 60000, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ this._timer.init(this, 60000, Ci.nsITimer.TYPE_ONE_SHOT);
var args =
- Components.classes["@mozilla.org/addressbook/directory/query-arguments;1"]
- .createInstance(Components.interfaces.nsIAbDirectoryQueryArguments);
+ Cc["@mozilla.org/addressbook/directory/query-arguments;1"]
+ .createInstance(Ci.nsIAbDirectoryQueryArguments);
var filterTemplate = this._book.getStringValue("autoComplete.filterTemplate", "");
// Use default value when preference is not set or it contains empty string
if (!filterTemplate)
filterTemplate = "(|(cn=%v1*%v2-*)(mail=%v1*%v2-*)(sn=%v1*%v2-*))";
// Create filter from filter template and search string
- var ldapSvc = Components.classes["@mozilla.org/network/ldap-service;1"]
- .getService(Components.interfaces.nsILDAPService);
+ var ldapSvc = Cc["@mozilla.org/network/ldap-service;1"]
+ .getService(Ci.nsILDAPService);
var filter = ldapSvc.createFilter(1024, filterTemplate, "", "", "", aSearchString);
if (!filter)
throw new Error("Filter string is empty, check if filterTemplate variable is valid in prefs.js.");
args.typeSpecificArg = this._attributes;
args.querySubDirectories = true;
args.filter = filter;
// Start the actual search
@@ -308,18 +308,16 @@ nsAbLDAPAutoCompleteSearch.prototype = {
this._result.searchResult = ACR.RESULT_NOMATCH_ONGOING;
this._listener.onSearchResult(this, this._result);
*/
},
// nsISupports
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
- Components.interfaces
- .nsIAutoCompleteSearch,
- Components.interfaces
- .nsIAbDirSearchListener])
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
+ Ci.nsIAutoCompleteSearch,
+ Ci.nsIAbDirSearchListener])
};
// Module
var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsAbLDAPAutoCompleteSearch]);
--- a/mailnews/addrbook/test/unit/test_basic_nsIAbCard.js
+++ b/mailnews/addrbook/test/unit/test_basic_nsIAbCard.js
@@ -11,18 +11,18 @@ var kEmailValue = "testEmail\u00D2@foo.i
var kEmailValueLC = "testemail\u00D2@foo.invalid";
var kEmailValue2 = "test@test.foo.invalid";
// Email without the @ or anything after it.
var kEmailReducedValue = "testEmail\u00D2";
var kCompanyValue = "Test\u00D0 Company";
function run_test() {
// Create a new card
- var card = Components.classes["@mozilla.org/addressbook/cardproperty;1"]
- .createInstance(Components.interfaces.nsIAbCard);
+ var card = Cc["@mozilla.org/addressbook/cardproperty;1"]
+ .createInstance(Ci.nsIAbCard);
// Test - Set First, Last and Display Names and Email Address
// via setProperty, and check correctly saved via their
// attributes. We're using firstName to check UTF-8 values.
card.setProperty("FirstName", kFNValue);
card.setProperty("LastName", kLNValue);
card.setProperty("DisplayName", kDNValue);
card.setProperty("PrimaryEmail", kEmailValue);
--- a/mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js
+++ b/mailnews/addrbook/test/unit/test_basic_nsIAbDirectory.js
@@ -29,17 +29,17 @@
function check_ab(abConfig) {
// Test - Get the directory
let AB = MailServices.ab.getDirectory(abConfig.URI);
// Test - Is it the right type?
if (abConfig.dirType == 2)
- Assert.ok(AB instanceof Components.interfaces.nsIAbMDBDirectory);
+ Assert.ok(AB instanceof Ci.nsIAbMDBDirectory);
// Test - Check attributes
Assert.equal(AB.generateName(0), abConfig.dirName);
Assert.equal(AB.propertiesChromeURI, kNormalPropertiesURI);
Assert.equal(AB.readOnly, abConfig.readOnly);
Assert.equal(AB.dirName, abConfig.dirName);
Assert.equal(AB.dirType, abConfig.dirType);
--- a/mailnews/addrbook/test/unit/test_bug_448165.js
+++ b/mailnews/addrbook/test/unit/test_bug_448165.js
@@ -7,11 +7,11 @@ function run_test() {
let pab = MailServices.ab.getDirectory(kPABData.URI);
Assert.ok(pab instanceof Ci.nsIAbDirectory);
try {
pab.deleteCards(null); // this should throw an error
do_throw("Error, deleteCards should throw an error when null is passed to it");
}
catch (e) {
// make sure the correct error message was thrown
- Assert.equal(e.result, Components.results.NS_ERROR_INVALID_POINTER);
+ Assert.equal(e.result, Cr.NS_ERROR_INVALID_POINTER);
}
}
--- a/mailnews/addrbook/test/unit/test_cardForEmail.js
+++ b/mailnews/addrbook/test/unit/test_cardForEmail.js
@@ -79,16 +79,16 @@ function run_test() {
Assert.ok(!cards.hasMoreElements());
cards = AB.getCardsFromProperty("LastName", "Doe", true);
var i = 0;
var data = [ 'John', 'Jane' ];
while (cards.hasMoreElements()) {
i++;
- card = cards.getNext().QueryInterface(Components.interfaces.nsIAbCard);
+ card = cards.getNext().QueryInterface(Ci.nsIAbCard);
Assert.equal(card.lastName, 'Doe');
var index = data.indexOf(card.firstName);
Assert.notEqual(index, -1);
delete data[index];
}
Assert.equal(i, 2);
};
--- a/mailnews/addrbook/test/unit/test_collection.js
+++ b/mailnews/addrbook/test/unit/test_collection.js
@@ -5,17 +5,17 @@
* This tests the main collection functions for adding new cards and modifying
* existing ones.
*
* Tests against cards in different ABs are done in test_collection_2.js.
*/
// make xpcshell-tests TEST_PATH=mailnews/addrbook/test/unit/test_collection.js
-var nsIAbPMF = Components.interfaces.nsIAbPreferMailFormat;
+var nsIAbPMF = Ci.nsIAbPreferMailFormat;
// Source fields (emailHeader/mailFormat) and expected results for use for
// testing the addition of new addresses to the database.
//
// Note: these email addresses should be different to allow collecting an
// address to add a different card each time.
var addEmailChecks =
// First 3 items aimed at basic collection and mail format.
@@ -261,18 +261,18 @@ function run_test()
// Get the actual AB for the collector so we can check cards have been
// added.
collectChecker.AB =
MailServices.ab.getDirectory(Services.prefs.getCharPref("mail.collect_addressbook"));
// Get the actual collecter
collectChecker.addressCollect =
- Components.classes["@mozilla.org/addressbook/services/addressCollector;1"]
- .getService(Components.interfaces.nsIAbAddressCollector);
+ Cc["@mozilla.org/addressbook/services/addressCollector;1"]
+ .getService(Ci.nsIAbAddressCollector);
// Test - Addition of header without email address.
collectChecker.addressCollect.collectAddress("MyTest <>", true,
nsIAbPMF.unknown);
// Address book should have no cards present.
Assert.ok(!collectChecker.AB.childCards.hasMoreElements());
@@ -294,18 +294,18 @@ function run_test()
collectChecker.part = 0;
addEmailChecks.forEach(collectChecker.checkAddress, collectChecker);
// Test - Do all emails at the same time.
// First delete all existing cards
var childCards = collectChecker.AB.childCards;
- var cardsToDelete = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var cardsToDelete = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
while (childCards.hasMoreElements()) {
cardsToDelete.appendElement(childCards.getNext());
}
collectChecker.AB.deleteCards(cardsToDelete);
// Null these directly, so gc() will purge them
childCards = null;
@@ -318,18 +318,18 @@ function run_test()
// Now do all emails at the same time.
collectChecker.checkAll(addEmailChecks);
// Test - Try and modify various emails and formats.
// Add a basic card with just primary and second email to allow testing
// of the case where we don't modify when second email is matching.
- card = Components.classes["@mozilla.org/addressbook/cardproperty;1"]
- .createInstance(Components.interfaces.nsIAbCard);
+ card = Cc["@mozilla.org/addressbook/cardproperty;1"]
+ .createInstance(Ci.nsIAbCard);
card.primaryEmail = "userprim\u00D0@foo.invalid";
card.setProperty("SecondEmail", "usersec\u00D0@foo.invalid");
collectChecker.AB.addCard(card);
collectChecker.part = 0;
--- a/mailnews/addrbook/test/unit/test_collection_2.js
+++ b/mailnews/addrbook/test/unit/test_collection_2.js
@@ -1,26 +1,26 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Test suite for the Address Collector Service part 2.
*
* This test checks that we don't collect addresses when they already exist
* in other address books.
*/
-var nsIAbPMF = Components.interfaces.nsIAbPreferMailFormat;
+var nsIAbPMF = Ci.nsIAbPreferMailFormat;
function run_test()
{
// Test - Get the address collecter
// Get the actual collecter
var addressCollect =
- Components.classes["@mozilla.org/addressbook/services/addressCollector;1"]
- .getService(Components.interfaces.nsIAbAddressCollector);
+ Cc["@mozilla.org/addressbook/services/addressCollector;1"]
+ .getService(Ci.nsIAbAddressCollector);
// Set the new pref afterwards to ensure we change correctly
Services.prefs.setCharPref("mail.collect_addressbook", kCABData.URI);
// For this test use an address book that isn't the one we're collecting
// to.
var testAB = do_get_file("data/collect.mab");
@@ -34,17 +34,17 @@ function run_test()
nsIAbPMF.unknown);
let PAB = MailServices.ab.getDirectory(kPABData.URI);
var childCards = PAB.childCards;
Assert.ok(childCards.hasMoreElements());
- var card = childCards.getNext().QueryInterface(Components.interfaces.nsIAbCard);
+ var card = childCards.getNext().QueryInterface(Ci.nsIAbCard);
Assert.equal(card.displayName, "Other Book");
Assert.equal(card.primaryEmail, "other@book.invalid");
// Check the CAB has no cards.
let CAB = MailServices.ab.getDirectory(kCABData.URI);
Assert.ok(!CAB.childCards.hasMoreElements());
--- a/mailnews/addrbook/test/unit/test_ldap1.js
+++ b/mailnews/addrbook/test/unit/test_ldap1.js
@@ -13,17 +13,17 @@ function run_test() {
if (!("nsIAbLDAPDirectory" in Components.interfaces))
return;
// Test - Create an LDAP directory
let abUri = MailServices.ab.newAddressBook("test", kLDAPTestSpec, kLDAPDirectory);
// Test - Check we have the directory.
let abDir = MailServices.ab.getDirectory(kLDAPUriPrefix + abUri)
- .QueryInterface(Components.interfaces.nsIAbLDAPDirectory);
+ .QueryInterface(Ci.nsIAbLDAPDirectory);
// Test - Check various fields
Assert.equal(abDir.dirName, "test");
Assert.equal(abDir.lDAPURL.spec, kLDAPTestSpec);
Assert.ok(abDir.readOnly);
// Test - Write a UTF-8 Auth DN and check it
abDir.authDn = "test\u00D0";
--- a/mailnews/addrbook/test/unit/test_ldap2.js
+++ b/mailnews/addrbook/test/unit/test_ldap2.js
@@ -18,17 +18,17 @@ function run_test() {
// Use a UTF-8 based directory name
var abUri =
MailServices.ab.newAddressBook("\u041C\u0435\u043B\u0435\u043D\u043A\u0438",
kLDAPTestSpec, kLDAPDirectory);
// Test - Check we have the directory.
let abDir = MailServices.ab.getDirectory(kLDAPUriPrefix + abUri)
- .QueryInterface(Components.interfaces.nsIAbLDAPDirectory);
+ .QueryInterface(Ci.nsIAbLDAPDirectory);
// Test - Check various fields
Assert.equal(abDir.dirName, "\u041C\u0435\u043B\u0435\u043D\u043A\u0438");
Assert.equal(abDir.lDAPURL.spec, kLDAPTestSpec);
Assert.ok(abDir.readOnly);
// XXX I'd really like a better check than this, to check that searching
// works correctly. However we haven't got the support for that at the moment
--- a/mailnews/addrbook/test/unit/test_mailList1.js
+++ b/mailnews/addrbook/test/unit/test_mailList1.js
@@ -11,17 +11,17 @@ function checkLists(childNodes, number)
var mailListArray = new Array(number);
for (var i = 0; i < number; ++i)
mailListArray[i] = null;
// See comment above for matching requirements
while (childNodes.hasMoreElements()) {
var list = childNodes.getNext();
- if (list instanceof Components.interfaces.nsIAbDirectory &&
+ if (list instanceof Ci.nsIAbDirectory &&
list.isMailList && list.dirName.startsWith('TestList')) {
var index = list.dirName.substr(8, list.dirName.length - 8);
Assert.equal(mailListArray[index - 1], null);
Assert.equal(list.URI, kPABData.URI + "/MailList" + index);
mailListArray[index - 1] = list;
}
}
@@ -47,18 +47,18 @@ function run_test() {
// Test - Check all the expected mailing lists exist.
// There are three lists in abLists.mab by default.
checkLists(AB.childNodes, 3);
// Test - Add a new list.
- var mailList = Components.classes["@mozilla.org/addressbook/directoryproperty;1"]
- .createInstance(Components.interfaces.nsIAbDirectory);
+ var mailList = Cc["@mozilla.org/addressbook/directoryproperty;1"]
+ .createInstance(Ci.nsIAbDirectory);
mailList.isMailList = true;
mailList.dirName = "TestList4";
mailList.listNickName = "test4";
mailList.description = "test4description";
AB.addMailList(mailList);
--- a/mailnews/addrbook/test/unit/test_nsAbAutoCompleteMyDomain.js
+++ b/mailnews/addrbook/test/unit/test_nsAbAutoCompleteMyDomain.js
@@ -1,32 +1,32 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Test suite for nsAbAutoCompleteSearch
*/
-var ACR = Components.interfaces.nsIAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
function acObserver() {}
acObserver.prototype = {
_search: null,
_result: null,
onSearchResult: function (aSearch, aResult) {
this._search = aSearch;
this._result = aResult;
}
};
function run_test() {
// Test - Create a new search component
- var acs = Components.classes["@mozilla.org/autocomplete/search;1?name=mydomain"]
- .getService(Components.interfaces.nsIAutoCompleteSearch);
+ var acs = Cc["@mozilla.org/autocomplete/search;1?name=mydomain"]
+ .getService(Ci.nsIAutoCompleteSearch);
var obs = new acObserver();
let obsNews = new acObserver();
let obsFollowup = new acObserver();
// Set up an identity in the account manager with the default settings
let identity = MailServices.accounts.createIdentity();
--- a/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch1.js
+++ b/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch1.js
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* First test suite for nsAbAutoCompleteSearch - tests searching in address
* books for autocomplete matches, and checks sort order is correct (without
* popularity checks).
*/
-var ACR = Components.interfaces.nsIAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
// Input and results arrays for the autocomplete tests. This are potentially
// more complicated than really required, but it was easier to do them
// on a pattern rather just doing the odd spot check.
//
// Note the expected arrays are in expected sort order as well.
var results = [ { email: "d <ema@foo.invalid>", dirName: kPABData.dirName }, // 0
{ email: "di <emai@foo.invalid>", dirName: kPABData.dirName }, // 1
@@ -188,55 +188,55 @@ function setupAddressBookData(aDirURI, a
let ab = MailServices.ab.getDirectory(aDirURI);
// Getting all directories ensures we create all ABs because mailing
// lists need help initialising themselves
MailServices.ab.directories;
let childCards0 = ab.childCards;
while (childCards0.hasMoreElements()) {
- let c = childCards0.getNext().QueryInterface(Components.interfaces.nsIAbCard);
+ let c = childCards0.getNext().QueryInterface(Ci.nsIAbCard);
ab.dropCard(c, false);
}
aCardData.forEach(function(cd) {
- let card = Components.classes["@mozilla.org/addressbook/cardproperty;1"]
- .createInstance(Components.interfaces.nsIAbCard);
+ let card = Cc["@mozilla.org/addressbook/cardproperty;1"]
+ .createInstance(Ci.nsIAbCard);
for (var prop in cd) {
card.setProperty(prop, cd[prop]);
}
ab.addCard(card);
});
aMailListData.forEach(function(ld) {
- let list = Components.classes["@mozilla.org/addressbook/directoryproperty;1"]
- .createInstance(Components.interfaces.nsIAbDirectory);
+ let list = Cc["@mozilla.org/addressbook/directoryproperty;1"]
+ .createInstance(Ci.nsIAbDirectory);
list.isMailList = true;
for (var prop in ld) {
list[prop] = ld[prop];
}
ab.addMailList(list);
});
let childCards = ab.childCards;
while (childCards.hasMoreElements()) {
- let c = childCards.getNext().QueryInterface(Components.interfaces.nsIAbCard);
+ let c = childCards.getNext().QueryInterface(Ci.nsIAbCard);
}
}
function run_test() {
// Set up addresses for in the personal address book.
setupAddressBookData(kPABData.URI, PAB_CARD_DATA, PAB_LIST_DATA);
// ... and collected addresses address book.
setupAddressBookData(kCABData.URI, CAB_CARD_DATA, CAB_LIST_DATA);
// Test - Create a new search component
- var acs = Components.classes["@mozilla.org/autocomplete/search;1?name=addrbook"]
- .getService(Components.interfaces.nsIAutoCompleteSearch);
+ var acs = Cc["@mozilla.org/autocomplete/search;1?name=addrbook"]
+ .getService(Ci.nsIAutoCompleteSearch);
var obs = new acObserver();
let obsNews = new acObserver();
let obsFollowup = new acObserver();
// Test - Check disabling of autocomplete
Services.prefs.setBoolPref("mail.enable_autocomplete", false);
--- a/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch2.js
+++ b/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch2.js
@@ -6,18 +6,18 @@
* We run this test without address books, constructing manually ourselves,
* so that we can ensure that we're not getting the data out of the address
* books.
*/
ChromeUtils.import("resource:///modules/ABQueryUtils.jsm");
// taken from nsAbAutoCompleteSearch.js
-var ACR = Components.interfaces.nsIAutoCompleteResult;
-var nsIAbAutoCompleteResult = Components.interfaces.nsIAbAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
+var nsIAbAutoCompleteResult = Ci.nsIAbAutoCompleteResult;
function nsAbAutoCompleteResult(aSearchString) {
// Can't create this in the prototype as we'd get the same array for
// all instances
this._searchResults = [];
this.searchString = aSearchString;
this.modelQuery = getModelQuery("mail.addr_book.autocompletequery.format");
}
@@ -76,18 +76,18 @@ nsAbAutoCompleteResult.prototype = {
},
// nsISupports
QueryInterface: XPCOMUtils.generateQI([ACR, nsIAbAutoCompleteResult])
}
function createCard(chars, popularity) {
- var card = Components.classes["@mozilla.org/addressbook/cardproperty;1"]
- .createInstance(Components.interfaces.nsIAbCard);
+ var card = Cc["@mozilla.org/addressbook/cardproperty;1"]
+ .createInstance(Ci.nsIAbCard);
card.firstName = "firstName".slice(0, chars);
card.lastName = "lastName".slice(0, chars);
card.displayName = "displayName".slice(0, chars);
card.primaryEmail = "email".slice(0, chars) + "@foo.invalid";
card.setProperty("NickName", "nickName".slice(0, chars));
return card;
@@ -146,18 +146,18 @@ acObserver.prototype = {
this._search = aSearch;
this._result = aResult;
}
};
function run_test() {
// Test - Create a new search component
- var acs = Components.classes["@mozilla.org/autocomplete/search;1?name=addrbook"]
- .getService(Components.interfaces.nsIAutoCompleteSearch);
+ var acs = Cc["@mozilla.org/autocomplete/search;1?name=addrbook"]
+ .getService(Ci.nsIAutoCompleteSearch);
var obs = new acObserver();
// Ensure we've got the comment column set up for extra checking.
Services.prefs.setIntPref("mail.autoComplete.commentColumn", 1);
// Make up the last autocomplete result
var lastResult = new nsAbAutoCompleteResult();
--- a/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch3.js
+++ b/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch3.js
@@ -1,14 +1,14 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Third Test suite for nsAbAutoCompleteSearch - test for duplicate elimination
*/
-var ACR = Components.interfaces.nsIAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
var cards = [
{ email: "test@foo.invalid", displayName: "",
popularityIndex: 0, firstName: "test0", value: "test@foo.invalid" },
{ email: "test@foo.invalid", displayName: "",
popularityIndex: 1, firstName: "test1", value: "test@foo.invalid" },
{ email: "abc@foo.invalid", displayName: "",
popularityIndex: 1, firstName: "test2", value: "abc@foo.invalid" },
@@ -69,18 +69,18 @@ function run_test()
ab.addCard(card);
}
cards.forEach(createAndAddCard);
// Test - duplicate elements
- var acs = Components.classes["@mozilla.org/autocomplete/search;1?name=addrbook"]
- .getService(Components.interfaces.nsIAutoCompleteSearch);
+ var acs = Cc["@mozilla.org/autocomplete/search;1?name=addrbook"]
+ .getService(Ci.nsIAutoCompleteSearch);
var obs = new acObserver();
function checkInputItem(element, index, array) {
print("Search #" + index + ": search=" + element.search);
acs.startSearch(element.search, JSON.stringify({ type: "addr_to" }), null, obs);
for (var i = 0; i < obs._result.matchCount; i++) {
--- a/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch4.js
+++ b/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch4.js
@@ -1,13 +1,13 @@
/*
* Fourth Test suite for nsAbAutoCompleteSearch - test for second email address.
*/
-var ACR = Components.interfaces.nsIAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
var cards = [
// Basic tests for primary and secondary emails.
{ email: "primary@test.invalid", secondEmail: "second@test.invalid",
firstName: "" },
{ email: "test1@test.invalid", secondEmail: "test2@test.invalid",
firstName: "firstName" },
{ email: "bar1@test.invalid", secondEmail: "bar2@test.invalid",
@@ -119,18 +119,18 @@ function run_test()
card.setProperty("PopularityIndex", element.popularityIndex);
card.firstName = element.firstName;
ab.addCard(card);
}
cards.forEach(createAndAddCard);
- var acs = Components.classes["@mozilla.org/autocomplete/search;1?name=addrbook"]
- .getService(Components.interfaces.nsIAutoCompleteSearch);
+ var acs = Cc["@mozilla.org/autocomplete/search;1?name=addrbook"]
+ .getService(Ci.nsIAutoCompleteSearch);
var obs = new acObserver();
print("Checking Initial Searches");
function checkSearch(element, index, array) {
print("Search #" + index + ": search=" + element);
acs.startSearch(element, JSON.stringify({ type: "addr_to", idKey: "" }), null, obs);
--- a/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch5.js
+++ b/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch5.js
@@ -1,15 +1,15 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* This suite ensures that we can correctly read and re-set the popularity
* indexes on a
*/
-var ACR = Components.interfaces.nsIAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
var results = [ { email: "d <ema@test.invalid>", dirName: kPABData.dirName },
{ email: "di <emai@test.invalid>", dirName: kPABData.dirName },
{ email: "dis <email@test.invalid>", dirName: kPABData.dirName },
{ email: "disp <e@test.invalid>", dirName: kPABData.dirName },
{ email: "displ <em@test.invalid>", dirName: kPABData.dirName },
{ email: "t <list>", dirName: kPABData.dirName },
{ email: "te <lis>", dirName: kPABData.dirName },
@@ -46,18 +46,18 @@ acObserver.prototype = {
function run_test() {
// Copy the data files into place
let testAB = do_get_file("../../../data/tb2hexpopularity.mab");
testAB.copyTo(do_get_profile(), kPABData.fileName);
// Test - Create a new search component
- let acs = Components.classes["@mozilla.org/autocomplete/search;1?name=addrbook"]
- .getService(Components.interfaces.nsIAutoCompleteSearch);
+ let acs = Cc["@mozilla.org/autocomplete/search;1?name=addrbook"]
+ .getService(Ci.nsIAutoCompleteSearch);
let obs = new acObserver();
// Ensure we've got the comment column set up for extra checking.
Services.prefs.setIntPref("mail.autoComplete.commentColumn", 1);
// Test - Matches
--- a/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch6.js
+++ b/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch6.js
@@ -1,14 +1,14 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* Tests for for nsAbAutoCompleteSearch scoring.
*/
-var ACR = Components.interfaces.nsIAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
var cards = [
{ // 0
email: "jd.who@example.com", displayName: "John Doe (:xx)",
popularityIndex: 0, firstName: "John", value: "John Doe (:xx) <jd.who@example.com>"
},
{ // 1
@@ -149,18 +149,18 @@ function run_test()
ab.addCard(card);
}
cards.forEach(createAndAddCard);
// Test - duplicate elements
- var acs = Components.classes["@mozilla.org/autocomplete/search;1?name=addrbook"]
- .getService(Components.interfaces.nsIAutoCompleteSearch);
+ var acs = Cc["@mozilla.org/autocomplete/search;1?name=addrbook"]
+ .getService(Ci.nsIAutoCompleteSearch);
var obs = new acObserver();
function checkInputItem(element, index, array) {
print("Search #" + index + ": search=" + element.search);
acs.startSearch(element.search, JSON.stringify({ type: "addr_to" }), null, obs);
for (var i = 0; i < obs._result.matchCount; i++) {
--- a/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch7.js
+++ b/mailnews/addrbook/test/unit/test_nsAbAutoCompleteSearch7.js
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Tests for nsAbAutoCompleteSearch - tests searching in address
* books for autocomplete matches, and checks sort order is correct
* according to scores.
*/
-var ACR = Components.interfaces.nsIAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
// Input and results arrays for the autocomplete tests.
// Note the expected arrays are in expected sort order as well.
var results = [
{ email: "Tomas Doe <tomez.doe@foo.invalid>" }, // 0
{ email: "Tomas Doe <tomez.doe@foo2.invalid>" }, // 1
@@ -75,53 +75,53 @@ function setupAddressBookData(aDirURI, a
let ab = MailServices.ab.getDirectory(aDirURI);
// Getting all directories ensures we create all ABs because mailing
// lists need help initialising themselves
MailServices.ab.directories;
let childCards0 = ab.childCards;
while (childCards0.hasMoreElements()) {
- let c = childCards0.getNext().QueryInterface(Components.interfaces.nsIAbCard);
+ let c = childCards0.getNext().QueryInterface(Ci.nsIAbCard);
ab.dropCard(c, false);
}
aCardData.forEach(function(cd) {
- let card = Components.classes["@mozilla.org/addressbook/cardproperty;1"]
- .createInstance(Components.interfaces.nsIAbCard);
+ let card = Cc["@mozilla.org/addressbook/cardproperty;1"]
+ .createInstance(Ci.nsIAbCard);
for (var prop in cd) {
card.setProperty(prop, cd[prop]);
}
ab.addCard(card);
});
aMailListData.forEach(function(ld) {
- let list = Components.classes["@mozilla.org/addressbook/directoryproperty;1"]
- .createInstance(Components.interfaces.nsIAbDirectory);
+ let list = Cc["@mozilla.org/addressbook/directoryproperty;1"]
+ .createInstance(Ci.nsIAbDirectory);
list.isMailList = true;
for (var prop in ld) {
list[prop] = ld[prop];
}
ab.addMailList(list);
});
let childCards = ab.childCards;
while (childCards.hasMoreElements()) {
- let c = childCards.getNext().QueryInterface(Components.interfaces.nsIAbCard);
+ let c = childCards.getNext().QueryInterface(Ci.nsIAbCard);
}
}
function run_test() {
// Set up addresses for in the personal address book.
setupAddressBookData(kPABData.URI, PAB_CARD_DATA, []);
// Test - Create a new search component
- var acs = Components.classes["@mozilla.org/autocomplete/search;1?name=addrbook"]
- .getService(Components.interfaces.nsIAutoCompleteSearch);
+ var acs = Cc["@mozilla.org/autocomplete/search;1?name=addrbook"]
+ .getService(Ci.nsIAutoCompleteSearch);
var obs = new acObserver();
let obsNews = new acObserver();
let obsFollowup = new acObserver();
let param = JSON.stringify({ type: "addr_to" });
// Now check multiple matches
--- a/mailnews/addrbook/test/unit/test_nsAbManager1.js
+++ b/mailnews/addrbook/test/unit/test_nsAbManager1.js
@@ -1,14 +1,14 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Test suite for nsAbManager functions relating to listeners.
*/
-var nsIAbListener = Components.interfaces.nsIAbListener;
+var nsIAbListener = Ci.nsIAbListener;
var numListenerOptions = 4;
var gAblAll;
var gAblSingle = new Array(numListenerOptions);
function abL() {}
abL.prototype = {
--- a/mailnews/addrbook/test/unit/test_nsAbManager2.js
+++ b/mailnews/addrbook/test/unit/test_nsAbManager2.js
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Test suite for nsAbManager functions relating to add/delete directories and
* getting the list of directories..
*/
-var nsIAbDirectory = Components.interfaces.nsIAbDirectory;
-var nsIAbListener = Components.interfaces.nsIAbListener;
+var nsIAbDirectory = Ci.nsIAbDirectory;
+var nsIAbListener = Ci.nsIAbListener;
var numListenerOptions = 4;
var gAblAll;
var gAblSingle = new Array(numListenerOptions);
function abL() {}
abL.prototype = {
--- a/mailnews/addrbook/test/unit/test_nsIAbCard.js
+++ b/mailnews/addrbook/test/unit/test_nsIAbCard.js
@@ -23,17 +23,17 @@ function run_test() {
var fullCard = null;
var tempCard;
while (childCards.hasMoreElements())
{
tempCard = childCards.getNext();
// We want the one with the right email...
- if (tempCard instanceof Components.interfaces.nsIAbCard &&
+ if (tempCard instanceof Ci.nsIAbCard &&
tempCard.primaryEmail == "PrimaryEmail1@test.invalid")
fullCard = tempCard;
}
Assert.ok(fullCard != null);
// Test - VCard.
--- a/mailnews/base/content/dateFormat.js
+++ b/mailnews/base/content/dateFormat.js
@@ -78,41 +78,41 @@ function initializeSearchDateFormat()
{
if (gSearchDateFormat)
return;
// get a search date format option and a seprator
try {
gSearchDateFormat =
Services.prefs.getComplexValue("mailnews.search_date_format",
- Components.interfaces.nsIPrefLocalizedString);
+ Ci.nsIPrefLocalizedString);
gSearchDateFormat = parseInt(gSearchDateFormat);
// if the option is 0 then try to use the format of the current locale
if (gSearchDateFormat == 0)
initLocaleShortDateFormat();
else
{
// initialize the search date format based on preferences
if ( gSearchDateFormat < 1 || gSearchDateFormat > 6 )
gSearchDateFormat = 3;
gSearchDateSeparator =
Services.prefs.getComplexValue("mailnews.search_date_separator",
- Components.interfaces.nsIPrefLocalizedString);
+ Ci.nsIPrefLocalizedString);
gSearchDateLeadingZeros =
(Services.prefs.getComplexValue(
"mailnews.search_date_leading_zeros",
- Components.interfaces.nsIPrefLocalizedString).data == "true");
+ Ci.nsIPrefLocalizedString).data == "true");
}
}
catch (e)
{
- Components.utils.reportError("initializeSearchDateFormat: caught an exception: " + e);
+ Cu.reportError("initializeSearchDateFormat: caught an exception: " + e);
// set to mm/dd/yyyy in case of error
gSearchDateFormat = 3;
gSearchDateSeparator = "/";
gSearchDateLeadingZeros = true;
}
}
function convertPRTimeToString(tm)
--- a/mailnews/base/content/folderProps.js
+++ b/mailnews/base/content/folderProps.js
@@ -99,25 +99,25 @@ function doEnabling()
var nameTextbox = document.getElementById("name");
document.documentElement.getButton("accept").disabled = !nameTextbox.value;
}
function folderPropsOKButton()
{
if (gMsgFolder)
{
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
// set charset attributes
var folderCharsetList = document.getElementById("folderCharsetList");
// Log to the Error Console the charset value for the folder
// if it is unknown to us. Value will be preserved by the menu-item.
if (folderCharsetList.selectedIndex == -1)
{
- Components.utils.reportError("Unknown folder encoding; folder=" +
+ Cu.reportError("Unknown folder encoding; folder=" +
gMsgFolder.name + ", charset=" + gMsgFolder.charset);
}
gMsgFolder.charset = folderCharsetList.getAttribute("value");
gMsgFolder.charsetOverride = document.getElementById("folderCharsetOverride")
.checked;
if(document.getElementById("offline.selectForOfflineFolder").checked ||
@@ -189,17 +189,17 @@ function folderPropsOnLoad()
// when the dialog is accepted.
var nameTextbox = document.getElementById("name");
nameTextbox.value = window.arguments[0].name;
// name.setSelectionRange(0,-1);
// name.focusTextField();
}
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
const serverType = window.arguments[0].serverType;
// Do this first, because of gloda we may want to override some of the hidden
// statuses.
hideShowControls(serverType);
if (gMsgFolder) {
// We really need a functioning database, so we'll detect problems
@@ -259,34 +259,34 @@ function folderPropsOnLoad()
let glodaFolder = Gloda.getFolderForFolder(gMsgFolder);
glodaCheckbox.checked =
glodaFolder.indexingPriority != glodaFolder.kIndexingNeverPriority;
}
}
if (serverType == "imap")
{
- var imapFolder = gMsgFolder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ var imapFolder = gMsgFolder.QueryInterface(Ci.nsIMsgImapMailFolder);
if (imapFolder)
imapFolder.fillInFolderProps(gFolderPropsSink);
}
var retentionSettings = gMsgFolder.retentionSettings;
initCommonRetentionSettings(retentionSettings);
document.getElementById("retention.useDefault").checked = retentionSettings.useServerDefaults;
// set folder sizes
let numberOfMsgs = gMsgFolder.getTotalMessages(false);
if (numberOfMsgs >= 0)
document.getElementById("numberOfMessages").value = numberOfMsgs;
try {
- let sizeOnDisk = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger)
- .formatFileSize(gMsgFolder.sizeOnDisk, true);
+ let sizeOnDisk = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger)
+ .formatFileSize(gMsgFolder.sizeOnDisk, true);
document.getElementById("sizeOnDisk").value = sizeOnDisk;
} catch (e) { }
// select the initial tab
if (window.arguments[0].tabID) {
try {
document.getElementById("folderPropTabBox").selectedTab =
document.getElementById(window.arguments[0].tabID);
@@ -318,32 +318,32 @@ function hideShowControls(serverType)
}
}
control.hidden = hideForBool;
}
// hide the priviliges button if the imap folder doesn't have an admin url
// mabye should leave this hidden by default and only show it in this case instead
try {
- var imapFolder = gMsgFolder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ var imapFolder = gMsgFolder.QueryInterface(Ci.nsIMsgImapMailFolder);
if (imapFolder)
{
var privilegesButton = document.getElementById("imap.FolderPrivileges");
if (privilegesButton)
{
if (!imapFolder.hasAdminUrl)
privilegesButton.setAttribute("hidden", "true");
}
}
}
catch (ex) {}
if (gMsgFolder)
{
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
// Hide "check for new mail" checkbox if this is an Inbox.
if (gMsgFolder.flags & nsMsgFolderFlags.Inbox)
document.getElementById("folderCheckForNewMessages").hidden = true;
// Retention policy doesn't apply to Drafts/Templates/Outbox.
if (gMsgFolder.isSpecialFolder(nsMsgFolderFlags.Drafts |
nsMsgFolderFlags.Templates |
nsMsgFolderFlags.Queue, true))
document.getElementById("Retention").hidden = true;
@@ -353,33 +353,33 @@ function hideShowControls(serverType)
function onOfflineFolderDownload()
{
// we need to create a progress window and pass that in as the second parameter here.
gMsgFolder.downloadAllForOffline(null, window.arguments[0].msgWindow);
}
function onFolderPrivileges()
{
- var imapFolder = gMsgFolder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ var imapFolder = gMsgFolder.QueryInterface(Ci.nsIMsgImapMailFolder);
if (imapFolder)
imapFolder.folderPrivileges(window.arguments[0].msgWindow);
// let's try closing the modal dialog to see if it fixes the various problems running this url
window.close();
}
function onUseDefaultRetentionSettings()
{
var useDefault = document.getElementById("retention.useDefault").checked;
document.getElementById('retention.keepMsg').disabled = useDefault;
document.getElementById('retention.keepNewMsgMinLabel').disabled = useDefault;
document.getElementById('retention.keepOldMsgMinLabel').disabled = useDefault;
var keepMsg = document.getElementById("retention.keepMsg").value;
- const nsIMsgRetentionSettings = Components.interfaces.nsIMsgRetentionSettings;
+ const nsIMsgRetentionSettings = Ci.nsIMsgRetentionSettings;
document.getElementById('retention.keepOldMsgMin').disabled =
useDefault || (keepMsg != nsIMsgRetentionSettings.nsMsgRetainByAge);
document.getElementById('retention.keepNewMsgMin').disabled =
useDefault || (keepMsg != nsIMsgRetentionSettings.nsMsgRetainByNumHeaders);
}
function RebuildSummaryInformation()
{
--- a/mailnews/base/content/folderWidgets.xml
+++ b/mailnews/base/content/folderWidgets.xml
@@ -145,33 +145,33 @@
deferred: function filter_defered(aFolder) {
return aFolder.server.canCreateFoldersOnServer &&
!aFolder.supportsOffline;
},
// Folders that are not in a deferred account
notDeferred: function(aFolder) {
let server = aFolder.server;
- return !(server instanceof Components.interfaces.nsIPop3IncomingServer &&
+ return !(server instanceof Ci.nsIPop3IncomingServer &&
server.deferredToAccount);
},
// Folders that can be searched.
search: function filter_search(aFolder) {
if (!aFolder.server.canSearchMessages ||
- aFolder.getFlag(Components.interfaces.nsMsgFolderFlags.Virtual))
+ aFolder.getFlag(Ci.nsMsgFolderFlags.Virtual))
return false;
return true;
},
// Folders that can subscribe feeds.
feeds: function filter_feeds(aFolder) {
if (aFolder.server.type != "rss" ||
- aFolder.getFlag(Components.interfaces.nsMsgFolderFlags.Trash) ||
- aFolder.getFlag(Components.interfaces.nsMsgFolderFlags.Virtual))
+ aFolder.getFlag(Ci.nsMsgFolderFlags.Trash) ||
+ aFolder.getFlag(Ci.nsMsgFolderFlags.Virtual))
return false;
return true;
},
junk: function filter_junk(aFolder) {
// Don't show servers (nntp & any others) which do not allow search or filing
// I don't really understand why canSearchMessages is needed, but it was included in
// earlier code, so I include it as well.
@@ -199,29 +199,29 @@
<field name="_listener">
<![CDATA[({
_menu: this,
_clearMenu: function(aMenu) {
if (aMenu._teardown)
aMenu._teardown();
},
OnItemAdded: function act_add(aRDFParentItem, aItem) {
- if (!(aItem instanceof Components.interfaces.nsIMsgFolder))
+ if (!(aItem instanceof Ci.nsIMsgFolder))
return;
if (this._filterFunction && !this._filterFunction(aItem)) {
return;
}
//xxx we can optimize this later
//xxx I'm not quite sure why this isn't always a function
if (this._menu._teardown)
this._menu._teardown();
},
OnItemRemoved: function act_remove(aRDFParentItem, aItem) {
- if (!(aItem instanceof Components.interfaces.nsIMsgFolder))
+ if (!(aItem instanceof Ci.nsIMsgFolder))
return;
if (this._filterFunction && !this._filterFunction(aItem)) {
return;
}
//xxx we can optimize this later
if (this._menu._teardown)
this._menu._teardown();
},
@@ -277,17 +277,17 @@
* @returns null if no child for that folder exists, otherwise the
* menuitem for that child
*/
_getChildForItem: function act__itemIsChild(aItem, aMenu) {
aMenu = aMenu || this._menu;
if (!aMenu || !aMenu.childNodes)
return null;
- if (!(aItem instanceof Components.interfaces.nsIMsgFolder))
+ if (!(aItem instanceof Ci.nsIMsgFolder))
return null;
for (let i = 0; i < aMenu.childNodes.length; i++) {
let folder = aMenu.childNodes[i]._folder;
if (folder && folder.URI == aItem.URI)
return aMenu.childNodes[i];
}
return null;
}
@@ -667,17 +667,17 @@
// First set the SpecialFolder attribute
aMenuNode.setAttribute("SpecialFolder", this.getSpecialFolderString(aFolder));
// Now set the biffState
let biffStates = ["NewMail", "NoMail", "UnknownMail"];
for (let state of biffStates) {
if (aFolder.biffState ==
- Components.interfaces.nsIMsgFolder["nsMsgBiffState_" + state]) {
+ Ci.nsIMsgFolder["nsMsgBiffState_" + state]) {
aMenuNode.setAttribute("BiffState", state);
break;
}
}
aMenuNode.setAttribute("IsServer", aFolder.isServer);
aMenuNode.setAttribute("IsSecure", aFolder.server.isSecure);
aMenuNode.setAttribute("ServerType", aFolder.server.type);
--- a/mailnews/base/content/jsTreeView.js
+++ b/mailnews/base/content/jsTreeView.js
@@ -221,15 +221,15 @@ PROTO_TREE_VIEW.prototype = {
// Note that as we iterate through here, .length may grow
for (let i = 0; i < this._rowMap.length; i++) {
if (this._persistOpenMap.indexOf(this._rowMap[i].id) != -1)
this.toggleOpenState(i);
}
},
QueryInterface: function QueryInterface(aIID) {
- if (aIID.equals(Components.interfaces.nsITreeView) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsITreeView) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
};
--- a/mailnews/base/content/junkCommands.js
+++ b/mailnews/base/content/junkCommands.js
@@ -53,17 +53,17 @@ function determineActionsForJunkMsgs(aFo
// despite the disabling
actions.markRead = spamSettings.markAsReadOnSpam;
actions.junkTargetFolder = null;
// move only when the corresponding setting is activated
// and the currently viewed folder is not the junk folder.
if (spamSettings.moveOnSpam &&
- !(aFolder.flags & Components.interfaces.nsMsgFolderFlags.Junk))
+ !(aFolder.flags & Ci.nsMsgFolderFlags.Junk))
{
var spamFolderURI = spamSettings.spamFolderURI;
if (!spamFolderURI)
{
// XXX TODO
// we should use nsIPromptService to inform the user of the problem,
// e.g. when the junk folder was accidentally deleted.
dump('determineActionsForJunkMsgs: no spam folder found, not moving.');
@@ -86,31 +86,31 @@ function determineActionsForJunkMsgs(aFo
* @param aJunkMsgHdrs
* nsIArray containing headers (nsIMsgDBHdr) of new junk messages
*
* @param aGoodMsgHdrs
* nsIArray containing headers (nsIMsgDBHdr) of new good messages
*/
function performActionsOnJunkMsgs(aFolder, aJunkMsgHdrs, aGoodMsgHdrs)
{
- if (aFolder instanceof Components.interfaces.nsIMsgImapMailFolder) // need to update IMAP custom flags
+ if (aFolder instanceof Ci.nsIMsgImapMailFolder) // need to update IMAP custom flags
{
if (aJunkMsgHdrs.length)
{
var junkMsgKeys = new Array();
for (var i = 0; i < aJunkMsgHdrs.length; i++)
- junkMsgKeys[i] = aJunkMsgHdrs.queryElementAt(i, Components.interfaces.nsIMsgDBHdr).messageKey;
+ junkMsgKeys[i] = aJunkMsgHdrs.queryElementAt(i, Ci.nsIMsgDBHdr).messageKey;
aFolder.storeCustomKeywords(null, "Junk", "NonJunk", junkMsgKeys, junkMsgKeys.length);
}
if (aGoodMsgHdrs.length)
{
var goodMsgKeys = new Array();
for (var i = 0; i < aGoodMsgHdrs.length; i++)
- goodMsgKeys[i] = aGoodMsgHdrs.queryElementAt(i, Components.interfaces.nsIMsgDBHdr).messageKey;
+ goodMsgKeys[i] = aGoodMsgHdrs.queryElementAt(i, Ci.nsIMsgDBHdr).messageKey;
aFolder.storeCustomKeywords(null, "NonJunk", "Junk", goodMsgKeys, goodMsgKeys.length);
}
}
if (aJunkMsgHdrs.length)
{
var actionParams = determineActionsForJunkMsgs(aFolder);
if (actionParams.markRead)
@@ -133,20 +133,20 @@ function determineActionsForJunkMsgs(aFo
* the folder with messages to be analyzed for junk
* @param aTotalMessages
* Number of messages to process, used for progress report only
*/
function MessageClassifier(aFolder, aTotalMessages)
{
this.mFolder = aFolder;
- this.mJunkMsgHdrs = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
- this.mGoodMsgHdrs = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ this.mJunkMsgHdrs = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
+ this.mGoodMsgHdrs = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
this.mMessages = new Object();
this.mMessageQueue = new Array();
this.mTotalMessages = aTotalMessages;
this.mProcessedMessages = 0;
this.firstMessage = true;
this.lastStatusTime = Date.now();
}
@@ -170,17 +170,17 @@ MessageClassifier.prototype =
return;
// check whitelisting
if (aSpamSettings.checkWhiteList(aMsgHdr))
{
// message is ham from whitelist
var db = aMsgHdr.folder.msgDatabase;
db.setStringProperty(aMsgHdr.messageKey, "junkscore",
- Components.interfaces.nsIJunkMailPlugin.IS_HAM_SCORE);
+ Ci.nsIJunkMailPlugin.IS_HAM_SCORE);
db.setStringProperty(aMsgHdr.messageKey, "junkscoreorigin", "whitelist");
this.mGoodMsgHdrs.appendElement(aMsgHdr);
return;
}
var messageURI = aMsgHdr.folder.generateMessageURI(aMsgHdr.messageKey) + "?fetchCompleteMessage=true";
this.mMessages[messageURI] = aMsgHdr;
if (this.firstMessage)
@@ -204,17 +204,17 @@ MessageClassifier.prototype =
* Junk classification (0: UNCLASSIFIED, 1: GOOD, 2: JUNK)
* @param aJunkPercent
* 0 - 100 indicator of junk likelihood, with 100 meaning probably junk
*/
onMessageClassified: function(aClassifiedMsgURI, aClassification, aJunkPercent)
{
if (!aClassifiedMsgURI)
return; // ignore end of batch
- var nsIJunkMailPlugin = Components.interfaces.nsIJunkMailPlugin;
+ var nsIJunkMailPlugin = Ci.nsIJunkMailPlugin;
var score = (aClassification == nsIJunkMailPlugin.JUNK) ?
nsIJunkMailPlugin.IS_SPAM_SCORE : nsIJunkMailPlugin.IS_HAM_SCORE;
const statusDisplayInterval = 1000; // milliseconds between status updates
// set these props via the db (instead of the message header
// directly) so that the nsMsgDBView knows to update the UI
//
var msgHdr = this.mMessages[aClassifiedMsgURI];
@@ -282,17 +282,17 @@ function analyzeMessagesForJunk() { proc
function processFolderForJunk(aAll)
{
MsgJunkMailInfo(true);
if (aAll)
{
// need to expand all threads, so we analyze everything
gDBView.doCommand(nsMsgViewCommandType.expandAll);
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView);
var count = treeView.rowCount;
if (!count)
return;
}
else
{
// suite uses GetSelectedIndices, mail uses gFolderDisplay.selectedMessages
var indices = typeof GetSelectedIndices != "undefined" ?
@@ -372,40 +372,40 @@ function JunkSelectedMessages(setAsJunk)
* @returns The number of messages deleted.
*/
function deleteJunkInFolder()
{
MsgJunkMailInfo(true);
// use direct folder commands if possible so we don't mess with the selection
let selectedFolder = gFolderDisplay.displayedFolder;
- if ( !(selectedFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual) )
+ if ( !(selectedFolder.flags & Ci.nsMsgFolderFlags.Virtual) )
{
- var junkMsgHdrs = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var junkMsgHdrs = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
var enumerator = gDBView.msgFolder.messages;
while (enumerator.hasMoreElements())
{
- var msgHdr = enumerator.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);
+ var msgHdr = enumerator.getNext().QueryInterface(Ci.nsIMsgDBHdr);
var junkScore = msgHdr.getStringProperty("junkscore");
- if (junkScore == Components.interfaces.nsIJunkMailPlugin.IS_SPAM_SCORE)
+ if (junkScore == Ci.nsIJunkMailPlugin.IS_SPAM_SCORE)
junkMsgHdrs.appendElement(msgHdr);
}
if (junkMsgHdrs.length)
gDBView.msgFolder.deleteMessages(junkMsgHdrs, msgWindow, false, false, null, true);
return junkMsgHdrs.length;
}
// Folder is virtual, let the view do the work (but we lose selection)
// need to expand all threads, so we find everything
gDBView.doCommand(nsMsgViewCommandType.expandAll);
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView);
var count = treeView.rowCount;
if (!count)
return 0;
var treeSelection = treeView.selection;
var clearedSelection = false;
@@ -415,17 +415,17 @@ function deleteJunkInFolder()
for (var i = 0; i < count; ++i)
{
try {
messageUri = gDBView.getURIForViewIndex(i);
}
catch (ex) {continue;} // blow off errors for dummy rows
var msgHdr = messenger.messageServiceFromURI(messageUri).messageURIToMsgHdr(messageUri);
var junkScore = msgHdr.getStringProperty("junkscore");
- var isJunk = (junkScore == Components.interfaces.nsIJunkMailPlugin.IS_SPAM_SCORE);
+ var isJunk = (junkScore == Ci.nsIJunkMailPlugin.IS_SPAM_SCORE);
// if the message is junk, select it.
if (isJunk)
{
// only do this once
if (!clearedSelection)
{
// clear the current selection
// since we will be deleting all selected messages
--- a/mailnews/base/content/junkLog.js
+++ b/mailnews/base/content/junkLog.js
@@ -8,17 +8,17 @@ ChromeUtils.import("resource://gre/modul
var gLogView;
var gLogFile;
function onLoad()
{
gLogView = document.getElementById("logView");
gLogView.docShell.allowJavascript = false; // for security, disable JS
- gLogFile = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ gLogFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
gLogFile.append("junklog.html");
if (gLogFile.exists())
{
// convert the file to a URL so we can load it.
gLogView.setAttribute("src", Services.io.newFileURI(gLogFile).spec);
}
}
--- a/mailnews/base/content/markByDate.js
+++ b/mailnews/base/content/markByDate.js
@@ -80,23 +80,23 @@ function markInDatabase( lower, upper )
if ( !messageDatabase )
{
dump( "markByDate::markInDatabase: there /is/ no database to operate on!\n" );
return;
}
// the headers which are going to be marked
- var headers = Components.classes["@mozilla.org/array;1"].createInstance( Components.interfaces.nsIMutableArray );
- var searchSession = Components.classes["@mozilla.org/messenger/searchSession;1"].createInstance( Components.interfaces.nsIMsgSearchSession );
- var searchTerms = Components.classes["@mozilla.org/array;1"].createInstance( Components.interfaces.nsIMutableArray );
- searchSession.addScopeTerm( Components.interfaces.nsMsgSearchScope.offlineMail, messageFolder );
+ var headers = Cc["@mozilla.org/array;1"].createInstance( Ci.nsIMutableArray );
+ var searchSession = Cc["@mozilla.org/messenger/searchSession;1"].createInstance( Ci.nsIMsgSearchSession );
+ var searchTerms = Cc["@mozilla.org/array;1"].createInstance( Ci.nsIMutableArray );
+ searchSession.addScopeTerm( Ci.nsMsgSearchScope.offlineMail, messageFolder );
- const nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
- const nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
+ const nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
+ const nsMsgSearchOp = Ci.nsMsgSearchOp;
var searchTerm = searchSession.createTerm();
searchTerm.attrib = nsMsgSearchAttrib.Date;
searchTerm.op = nsMsgSearchOp.IsBefore;
var value = searchTerm.value;
value.attrib = nsMsgSearchAttrib.Date;
value.date = upper;
searchTerm.value = value;
--- a/mailnews/base/content/msgAccountCentral.js
+++ b/mailnews/base/content/msgAccountCentral.js
@@ -49,17 +49,17 @@ function OnInit()
SetItemDisplay("CreateAccount", true);
SetItemDisplay("CreateAccounts", true);
}
// Set the title for the document
document.getElementById("AccountCentralTitle").setAttribute("value", title);
}
catch(ex) {
- Components.utils.reportError("Error getting selected account: " + ex + "\n");
+ Cu.reportError("Error getting selected account: " + ex + "\n");
}
}
// Show items in the AccountCentral page depending on the capabilities
// of the given account
function ArrangeAccountCentralItems(server, msgFolder)
{
let exceptions = [];
@@ -203,17 +203,17 @@ function ArrangeAccountCentralItems(serv
SetItemDisplay("AdvancedFeaturesHeader", displayAdvFeatures);
/***** Advanced Featuers header and items : End *****/
// If either of above features exist, show section separators
SetItemDisplay("AccountsSection", displayAdvFeatures);
while (exceptions.length) {
- Components.utils.reportError("Error in setting AccountCentral Items: "
+ Cu.reportError("Error in setting AccountCentral Items: "
+ exceptions.pop() + "\n");
}
}
// Show the item if the item feature is supported
function SetItemDisplay(elemId, displayThisItem)
{
if (displayThisItem) {
@@ -249,18 +249,17 @@ function GetSelectedMsgFolder()
function ReadMessages()
{
if (!selectedServer)
return;
try {
window.parent.OpenInboxForServer(selectedServer);
}
catch(ex) {
- Components.utils
- .reportError("Error opening Inbox for server: " + ex + "\n");
+ Cu.reportError("Error opening Inbox for server: " + ex + "\n");
}
}
// Trigger composer for a new message
function ComposeAMessage(event)
{
// Pass event to allow holding Shift key for toggling HTML vs. plaintext format
window.parent.MsgNewMessage(event);
--- a/mailnews/base/content/msgPrintEngine.js
+++ b/mailnews/base/content/msgPrintEngine.js
@@ -20,18 +20,18 @@ function OnLoadPrintEngine()
PrintEngineCreateGlobals();
InitPrintEngineWindow();
printEngine.startPrintOperation(printSettings);
}
function PrintEngineCreateGlobals()
{
/* get the print engine instance */
- printEngine = Components.classes[printEngineContractID].createInstance();
- printEngine = printEngine.QueryInterface(Components.interfaces.nsIMsgPrintEngine);
+ printEngine = Cc[printEngineContractID].createInstance();
+ printEngine = printEngine.QueryInterface(Ci.nsIMsgPrintEngine);
printSettings = PrintUtils.getPrintSettings();
if (printSettings) {
printSettings.isCancelled = false;
}
}
var PrintPreviewListener = {
getPrintPreviewBrowser: function () {
@@ -134,17 +134,17 @@ function InitPrintEngineWindow()
} else {
printEngine.doPrintPreview = false;
}
printEngine.showWindow(false);
if (window.arguments.length > 4) {
printEngine.setMsgType(window.arguments[4]);
} else {
- printEngine.setMsgType(Components.interfaces.nsIMsgPrintEngine.MNAB_START);
+ printEngine.setMsgType(Ci.nsIMsgPrintEngine.MNAB_START);
}
if (window.arguments.length > 5) {
printEngine.setParentWindow(window.arguments[5]);
} else {
printEngine.setParentWindow(null);
}
--- a/mailnews/base/content/msgSynchronize.js
+++ b/mailnews/base/content/msgSynchronize.js
@@ -39,18 +39,18 @@ function syncOkButton()
var workOffline = document.getElementById("workOffline").checked;
Services.prefs.setBoolPref("mailnews.offline_sync_mail", syncMail);
Services.prefs.setBoolPref("mailnews.offline_sync_news", syncNews);
Services.prefs.setBoolPref("mailnews.offline_sync_send_unsent", sendMessage);
Services.prefs.setBoolPref("mailnews.offline_sync_work_offline", workOffline);
if (syncMail || syncNews || sendMessage || workOffline) {
- var offlineManager = Components.classes["@mozilla.org/messenger/offline-manager;1"]
- .getService(Components.interfaces.nsIMsgOfflineManager);
+ var offlineManager = Cc["@mozilla.org/messenger/offline-manager;1"]
+ .getService(Ci.nsIMsgOfflineManager);
if(offlineManager)
offlineManager.synchronizeForOffline(syncNews, syncMail, sendMessage, workOffline, gParentMsgWindow)
}
return true;
}
function OnSelect()
@@ -64,35 +64,35 @@ function OnSelect()
function selectOkButton()
{
return true;
}
function selectCancelButton()
{
- var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
- .getService(Components.interfaces.nsIRDFService);
+ var RDF = Cc["@mozilla.org/rdf/rdf-service;1"]
+ .getService(Ci.nsIRDFService);
for (var resourceValue in gInitialFolderStates) {
var resource = RDF.GetResource(resourceValue);
- var folder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
+ var folder = resource.QueryInterface(Ci.nsIMsgFolder);
if (gInitialFolderStates[resourceValue])
- folder.setFlag(Components.interfaces.nsMsgFolderFlags.Offline);
+ folder.setFlag(Ci.nsMsgFolderFlags.Offline);
else
- folder.clearFlag(Components.interfaces.nsMsgFolderFlags.Offline);
+ folder.clearFlag(Ci.nsMsgFolderFlags.Offline);
}
return true;
}
function selectOnLoad()
{
- gMsgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
+ gMsgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
+ .createInstance(Ci.nsIMsgWindow);
gMsgWindow.domWindow = window;
- gMsgWindow.rootDocShell.appType = Components.interfaces.nsIDocShell.APP_TYPE_MAIL;
+ gMsgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
gSynchronizeTree = document.getElementById('synchronizeTree');
SortSynchronizePane('folderNameCol', '?folderTreeNameSort');
}
function SortSynchronizePane(column, sortKey)
{
@@ -135,29 +135,29 @@ function onSynchronizeClick(event)
var elt = {}
gSynchronizeTree.treeBoxObject.getCellAt(event.clientX, event.clientY, row, col, elt);
if (row.value == -1)
return;
if (elt.value == "twisty") {
var folderResource = GetFolderResource(gSynchronizeTree, row.value);
- var folder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
+ var folder = folderResource.QueryInterface(Ci.nsIMsgFolder);
if (!(gSynchronizeTree.treeBoxObject.view.isContainerOpen(row.value))) {
var serverType = folder.server.type;
// imap is the only server type that does folder discovery
if (serverType != "imap") return;
if (folder.isServer) {
var server = folder.server;
server.performExpand(gMsgWindow);
}
else {
- var imapFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ var imapFolder = folderResource.QueryInterface(Ci.nsIMsgImapMailFolder);
if (imapFolder) {
imapFolder.performExpand(gMsgWindow);
}
}
}
}
else {
if (col.value.id == "syncCol") {
@@ -178,23 +178,23 @@ function onSynchronizeTreeKeyPress(event
treeSelection.getRangeAt(i,start,end);
for (var k=start.value;k<=end.value;k++)
UpdateNode(GetFolderResource(gSynchronizeTree, k), k);
}
}
function UpdateNode(resource, row)
{
- var folder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
+ var folder = resource.QueryInterface(Ci.nsIMsgFolder);
if (folder.isServer)
return;
if (!(resource.Value in gInitialFolderStates)) {
- gInitialFolderStates[resource.Value] = folder.getFlag(Components.interfaces.nsMsgFolderFlags.Offline);
+ gInitialFolderStates[resource.Value] = folder.getFlag(Ci.nsMsgFolderFlags.Offline);
}
- folder.toggleFlag(Components.interfaces.nsMsgFolderFlags.Offline);
+ folder.toggleFlag(Ci.nsMsgFolderFlags.Offline);
}
function GetFolderResource(aTree, aIndex) {
return aTree.builderView.getResourceAtIndex(aIndex);
}
--- a/mailnews/base/content/newmailalert.js
+++ b/mailnews/base/content/newmailalert.js
@@ -49,17 +49,17 @@ function prefillAlertInfo()
.replace("#1", rootFolder.prettyName)
.replace("#2", totalNumNewMessages);
// This is really the root folder and we have to walk through the list to
// find the real folder that has new mail in it...:(
let allFolders = rootFolder.descendants;
var folderSummaryInfoEl = document.getElementById('folderSummaryInfo');
folderSummaryInfoEl.mMaxMsgHdrsInPopup = gNumNewMsgsToShowInAlert;
- for (let folder of fixIterator(allFolders, Components.interfaces.nsIMsgFolder))
+ for (let folder of fixIterator(allFolders, Ci.nsIMsgFolder))
{
if (folder.hasNewMessages && !folder.getFlag(Ci.nsMsgFolderFlags.Virtual))
{
var asyncFetch = {};
folderSummaryInfoEl.parseFolder(folder, new urlListener(folder), asyncFetch);
if (asyncFetch.value)
gPendingPreviewFetchRequests++;
}
--- a/mailnews/base/content/shutdownWindow.js
+++ b/mailnews/base/content/shutdownWindow.js
@@ -3,18 +3,18 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
var curTaskIndex = 0;
var numTasks = 0;
var stringBundle;
-var msgShutdownService = Components.classes["@mozilla.org/messenger/msgshutdownservice;1"]
- .getService(Components.interfaces.nsIMsgShutdownService);
+var msgShutdownService = Cc["@mozilla.org/messenger/msgshutdownservice;1"]
+ .getService(Ci.nsIMsgShutdownService);
function onLoad()
{
numTasks = msgShutdownService.getNumTasks();
stringBundle = document.getElementById("bundle_shutdown");
document.title = stringBundle.getString("shutdownDialogTitle");
@@ -51,27 +51,27 @@ function nsMsgShutdownTaskListener()
{
msgShutdownService.setShutdownListener(this);
}
nsMsgShutdownTaskListener.prototype =
{
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIWebProgressListener) ||
- iid.equals(Components.interfaces.nsISupportsWeakReference) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIWebProgressListener) ||
+ iid.equals(Ci.nsISupportsWeakReference) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus)
{
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP)
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
{
window.close();
}
},
onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
{
updateProgressMeter(((aCurTotalProgress / aMaxTotalProgress) * 100));
--- a/mailnews/base/content/subscribe.js
+++ b/mailnews/base/content/subscribe.js
@@ -137,17 +137,17 @@ function SetUpTree(forceToServer, getOnl
{
if (!gServerURI)
return;
var server = MailUtils.getFolderForURI(gServerURI, true).server;
try
{
CleanUpSearchView();
- gSubscribableServer = server.QueryInterface(Components.interfaces.nsISubscribableServer);
+ gSubscribableServer = server.QueryInterface(Ci.nsISubscribableServer);
gSubscribeTree.setAttribute('ref', ''); // XXX: what is this?
// enable (or disable) the search related UI
EnableSearchUI();
// clear out the text field when switching server
gNameField.value = "";
@@ -213,40 +213,40 @@ function SubscribeOnLoad()
gSubscribeBody = document.getElementById("subscribeTreeBody");
gSearchTree = document.getElementById("searchTree");
gSearchTreeBoxObject = document.getElementById("searchTree").treeBoxObject;
gNameField = document.getElementById("namefield");
gNameFieldLabel = document.getElementById("namefieldlabel");
gSubscribeDeck = document.getElementById("subscribedeck");
- msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
+ msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
+ .createInstance(Ci.nsIMsgWindow);
msgWindow.domWindow = window;
gStatusFeedback = new nsMsgStatusFeedback
msgWindow.statusFeedback = gStatusFeedback;
msgWindow.rootDocShell.allowAuth = true;
- msgWindow.rootDocShell.appType = Components.interfaces.nsIDocShell.APP_TYPE_MAIL;
+ msgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
// look in arguments[0] for parameters
if (window.arguments && window.arguments[0]) {
if ( window.arguments[0].okCallback ) {
top.okCallback = window.arguments[0].okCallback;
}
}
var serverMenu = document.getElementById("serverMenu");
gServerURI = null;
let folder = window.arguments[0].folder;
- if (folder && folder.server instanceof Components.interfaces.nsISubscribableServer) {
+ if (folder && folder.server instanceof Ci.nsISubscribableServer) {
serverMenu.menupopup.selectFolder(folder.server.rootMsgFolder);
try {
CleanUpSearchView();
- gSubscribableServer = folder.server.QueryInterface(Components.interfaces.nsISubscribableServer);
+ gSubscribableServer = folder.server.QueryInterface(Ci.nsISubscribableServer);
// enable (or disable) the search related UI
EnableSearchUI();
gServerURI = folder.server.serverURI;
}
catch (ex) {
//dump("not a subscribable server\n");
CleanUpSearchView();
gSubscribableServer = null;
@@ -534,17 +534,17 @@ function SwitchToSearchView()
function Search()
{
var searchValue = gNameField.value;
if (searchValue.length && gSubscribableServer.supportsSubscribeSearch) {
SwitchToSearchView();
gSubscribableServer.setSearchValue(searchValue);
if (!gSearchView && gSubscribableServer) {
- gSearchView = gSubscribableServer.QueryInterface(Components.interfaces.nsITreeView);
+ gSearchView = gSubscribableServer.QueryInterface(Ci.nsITreeView);
gSearchView.selection = null;
gSearchTreeBoxObject.view = gSearchView;
}
}
else {
SwitchToNormalView();
}
}
--- a/mailnews/base/content/virtualFolderListEdit.js
+++ b/mailnews/base/content/virtualFolderListEdit.js
@@ -2,18 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gSelectVirtual = {
_treeElement: null,
_selectedList: new Set(),
load: function() {
- let folderLookup = Components.classes["@mozilla.org/mail/folder-lookup;1"]
- .getService(Ci.nsIFolderLookupService);
+ let folderLookup = Cc["@mozilla.org/mail/folder-lookup;1"]
+ .getService(Ci.nsIFolderLookupService);
if (window.arguments[0].searchFolderURIs) {
let srchFolderUriArray = window.arguments[0].searchFolderURIs.split('|');
for (let uri of srchFolderUriArray) {
this._selectedList.add(folderLookup.getFolderForURL(uri));
}
}
// Now tweak the folder tree for our purposes here.
--- a/mailnews/base/content/virtualFolderProperties.js
+++ b/mailnews/base/content/virtualFolderProperties.js
@@ -5,17 +5,17 @@
var gPickedFolder;
var gMailView = null;
var msgWindow; // important, don't change the name of this variable. it's really a global used by commandglue.js
var gSearchTermSession; // really an in memory temporary filter we use to read in and write out the search terms
var gSearchFolderURIs = "";
var gMessengerBundle = null;
-var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
+var nsMsgSearchScope = Ci.nsMsgSearchScope;
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource:///modules/virtualFolderWrapper.js");
ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
ChromeUtils.import("resource:///modules/MailUtils.js");
@@ -42,23 +42,23 @@ function onLoad()
}
else // we are creating a new virtual folder
{
acceptButton.label =
document.documentElement.getAttribute("newFolderAcceptButtonLabel");
acceptButton.accesskey =
document.documentElement.getAttribute("newFolderAcceptButtonAccessKey");
// it is possible that we were given arguments to pre-fill the dialog with...
- gSearchTermSession = Components.classes["@mozilla.org/messenger/searchSession;1"]
- .createInstance(Components.interfaces.nsIMsgSearchSession);
+ gSearchTermSession = Cc["@mozilla.org/messenger/searchSession;1"]
+ .createInstance(Ci.nsIMsgSearchSession);
if (windowArgs.searchTerms) // then add them to our search session
{
for (let searchTerm of fixIterator(windowArgs.searchTerms,
- Components.interfaces.nsIMsgSearchTerm))
+ Ci.nsIMsgSearchTerm))
gSearchTermSession.appendTerm(searchTerm);
}
if (windowArgs.folder)
{
// pre select the folderPicker, based on what they selected in the folder pane
gPickedFolder = windowArgs.folder;
try {
document.getElementById("msgNewFolderPopup").selectFolder(windowArgs.folder);
--- a/mailnews/base/prefs/content/AccountManager.js
+++ b/mailnews/base/prefs/content/AccountManager.js
@@ -206,17 +206,17 @@ function selectServer(server, selectPage
accountTree.treeBoxObject.ensureRowIsVisible(index);
}
function replaceWithDefaultSmtpServer(deletedSmtpServerKey)
{
// First we replace the smtpserverkey in every identity.
let am = MailServices.accounts;
for (let identity of fixIterator(am.allIdentities,
- Components.interfaces.nsIMsgIdentity)) {
+ Ci.nsIMsgIdentity)) {
if (identity.smtpServerKey == deletedSmtpServerKey)
identity.smtpServerKey = "";
}
// When accounts have already been loaded in the panel then the first
// replacement will be overwritten when the accountvalues are written out
// from the pagedata. We get the loaded accounts and check to make sure
// that the account exists for the accountid and that it has a default
@@ -356,33 +356,33 @@ function checkDirectoryIsAllowed(aLocalP
if (aDirToCheck.OS) {
if (aDirToCheck.OS.split(",").indexOf(Services.appinfo.OS) == -1)
return true;
}
let testDir = null;
if ("dirsvc" in aDirToCheck) {
try {
- testDir = Services.dirsvc.get(aDirToCheck.dirsvc, Components.interfaces.nsIFile);
+ testDir = Services.dirsvc.get(aDirToCheck.dirsvc, Ci.nsIFile);
} catch (e) {
- Components.utils.reportError("The special folder " + aDirToCheck.dirsvc +
+ Cu.reportError("The special folder " + aDirToCheck.dirsvc +
" cannot be retrieved on this platform: " + e);
}
if (!testDir)
return true;
}
else if ("dir" in aDirToCheck) {
- testDir = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ testDir = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
testDir.initWithPath(aDirToCheck.dir);
if (!testDir.exists())
return true;
} else {
- Components.utils.reportError("No directory to check?");
+ Cu.reportError("No directory to check?");
return true;
}
testDir.normalize();
if (testDir.equals(aLocalPath) || aLocalPath.contains(testDir))
return false;
@@ -459,17 +459,17 @@ function checkDirectoryIsUsable(aLocalPa
Services.prompt.alert(window, kAlertTitle, alertNotAllowed);
return false;
}
// Check that no other account has this same or dependent local directory.
let allServers = MailServices.accounts.allServers;
for (let server of fixIterator(allServers,
- Components.interfaces.nsIMsgIncomingServer))
+ Ci.nsIMsgIncomingServer))
{
if (server.key == currentAccount.incomingServer.key)
continue;
let serverPath = server.localPath;
try {
serverPath.normalize();
let alertStringID = null;
@@ -485,17 +485,17 @@ function checkDirectoryIsUsable(aLocalPa
.getFormattedString(alertStringID,
[server.prettyName]);
Services.prompt.alert(window, kAlertTitle, alertString);
return false;
}
} catch (e) {
// The other account's path is seriously broken, so we can't compare it.
- Components.utils.reportError("The Local Directory path of the account " +
+ Cu.reportError("The Local Directory path of the account " +
server.prettyName + " seems invalid.");
}
}
return true;
}
/**
@@ -599,17 +599,17 @@ function checkUserServerChanges(showAler
// Check the new value of the server.localPath field for validity.
var pathElem = getPageFormElement("server.localPath");
if (!pathElem)
return true;
if (!checkDirectoryIsUsable(getFormElementValue(pathElem))) {
// return false; // Temporarily disable this. Just show warning but do not block. See bug 921371.
- Components.utils.reportError("Local directory '" +
+ Cu.reportError("Local directory '" +
getFormElementValue(pathElem).path + "' of account " +
currentAccount.key + " is not safe to use. Consider changing it.");
}
// Warn if the Local directory path was changed.
// This can be removed once bug 2654 is fixed.
let oldLocalDir = getAccountValue(currentAccount, accountValues, "server", "localPath",
null, false); // both return nsIFile
@@ -819,23 +819,23 @@ function saveAccount(accountValues, acco
for (var slot in typeArray) {
var dest;
try {
if (type == "identity")
dest = identity;
else if (type == "server")
dest = server;
else if (type == "pop3")
- dest = server.QueryInterface(Components.interfaces.nsIPop3IncomingServer);
+ dest = server.QueryInterface(Ci.nsIPop3IncomingServer);
else if (type == "imap")
- dest = server.QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ dest = server.QueryInterface(Ci.nsIImapIncomingServer);
else if (type == "none")
- dest = server.QueryInterface(Components.interfaces.nsINoIncomingServer);
+ dest = server.QueryInterface(Ci.nsINoIncomingServer);
else if (type == "nntp")
- dest = server.QueryInterface(Components.interfaces.nsINntpIncomingServer);
+ dest = server.QueryInterface(Ci.nsINntpIncomingServer);
else if (type == "smtp")
dest = MailServices.smtp.defaultServer;
} catch (ex) {
// don't do anything, just means we don't support that
}
if (dest == undefined) continue;
@@ -1125,17 +1125,17 @@ function pageURL(pageId)
catch (ex) {
chromePackageName = "messenger";
}
return "chrome://" + chromePackageName + "/content/" + pageId;
}
function loadPage(pageId)
{
- const LOAD_FLAGS_NONE = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
+ const LOAD_FLAGS_NONE = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
document.getElementById("contentFrame").webNavigation.loadURI(pageURL(pageId),
LOAD_FLAGS_NONE, null, null, null);
}
// save the values of the widgets to the given server
function savePage(account)
{
if (!account)
@@ -1187,23 +1187,23 @@ function getAccountValue(account, accoun
server= account.incomingServer;
var source = null;
try {
if (type == "identity")
source = account.defaultIdentity;
else if (type == "server")
source = account.incomingServer;
else if (type == "pop3")
- source = server.QueryInterface(Components.interfaces.nsIPop3IncomingServer);
+ source = server.QueryInterface(Ci.nsIPop3IncomingServer);
else if (type == "imap")
- source = server.QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ source = server.QueryInterface(Ci.nsIImapIncomingServer);
else if (type == "none")
- source = server.QueryInterface(Components.interfaces.nsINoIncomingServer);
+ source = server.QueryInterface(Ci.nsINoIncomingServer);
else if (type == "nntp")
- source = server.QueryInterface(Components.interfaces.nsINntpIncomingServer);
+ source = server.QueryInterface(Ci.nsINntpIncomingServer);
else if (type == "smtp")
source = MailServices.smtp.defaultServer;
} catch (ex) {
}
if (source) {
if (isGeneric) {
if (!(type in gGenericAttributeTypes))
@@ -1319,31 +1319,31 @@ function getFormElementValue(formElement
if (type == "checkbox") {
if (formElement.getAttribute("reversed"))
return !formElement.checked;
return formElement.checked;
}
if (type == "textbox" &&
formElement.getAttribute("datatype") == "nsIFile") {
if (formElement.value) {
- let localfile = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ let localfile = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
localfile.initWithPath(formElement.value);
return localfile;
}
return null;
}
if ((type == "textbox") || ("value" in formElement)) {
return formElement.value;
}
return null;
}
catch (ex) {
- Components.utils.reportError("getFormElementValue failed, ex=" + ex + "\n");
+ Cu.reportError("getFormElementValue failed, ex=" + ex + "\n");
}
return null;
}
/**
* Sets the value of a widget in current the account settings page,
* automatically setting the right property of it depending on element type.
*
@@ -1367,17 +1367,17 @@ function setFormElementValue(formElement
formElement.selectedIndex = 0;
else
formElement.value = value;
}
// handle nsIFile
else if (type == "textbox" &&
formElement.getAttribute("datatype") == "nsIFile") {
if (value) {
- let localfile = value.QueryInterface(Components.interfaces.nsIFile);
+ let localfile = value.QueryInterface(Ci.nsIFile);
try {
formElement.value = localfile.path;
} catch (ex) {
dump("Still need to fix uninitialized nsIFile problem!\n");
}
} else {
formElement.value = "";
}
@@ -1473,18 +1473,18 @@ var gAccountTree = {
onServerLoaded: function at_onServerLoaded(aServer) {
this._build();
},
onServerUnloaded: function at_onServerUnloaded(aServer) {
this._build();
},
onServerChanged: function at_onServerChanged(aServer) {},
- _dataStore: Components.classes["@mozilla.org/xul/xulstore;1"]
- .getService(Components.interfaces.nsIXULStore),
+ _dataStore: Cc["@mozilla.org/xul/xulstore;1"]
+ .getService(Ci.nsIXULStore),
/**
* Retrieve from XULStore.json whether the account should be expanded (open)
* in the account tree.
*
* @param aAccountKey key of the account to check
*/
_getAccountOpenState: function at_getAccountOpenState(aAccountKey) {
@@ -1552,47 +1552,47 @@ var gAccountTree = {
// Check offline/diskspace support level.
let diskspace = server.supportsDiskSpace;
if (server.offlineSupportLevel >= 10 && diskspace)
panelsToKeep.push(panels[2]);
else if (diskspace)
panelsToKeep.push(panels[3]);
// extensions
- let catMan = Components.classes["@mozilla.org/categorymanager;1"]
- .getService(Ci.nsICategoryManager);
+ let catMan = Cc["@mozilla.org/categorymanager;1"]
+ .getService(Ci.nsICategoryManager);
const CATEGORY = "mailnews-accountmanager-extensions";
let catEnum = catMan.enumerateCategory(CATEGORY);
while (catEnum.hasMoreElements()) {
let entryName = null;
try {
entryName = catEnum.getNext().QueryInterface(Ci.nsISupportsCString).data;
- let svc = Components.classes[catMan.getCategoryEntry(CATEGORY, entryName)]
- .getService(Ci.nsIMsgAccountManagerExtension);
+ let svc = Cc[catMan.getCategoryEntry(CATEGORY, entryName)]
+ .getService(Ci.nsIMsgAccountManagerExtension);
if (svc.showPanel(server)) {
let bundleName = "chrome://" + svc.chromePackageName +
"/locale/am-" + svc.name + ".properties";
let bundle = Services.strings.createBundle(bundleName);
let title = bundle.GetStringFromName("prefPanel-" + svc.name);
panelsToKeep.push({string: title, src: "am-" + svc.name + ".xul"});
}
} catch(e) {
// Fetching of this extension panel failed so do not show it,
// just log error.
let extName = entryName || "(unknown)";
- Components.utils.reportError("Error accessing panel from extension '" +
- extName + "': " + e);
+ Cu.reportError("Error accessing panel from extension '" +
+ extName + "': " + e);
}
}
amChrome = server.accountManagerChrome;
} catch(e) {
// Show only a placeholder in the account list saying this account
// is broken, with no child panels.
let accountID = (accountName || accountKey);
- Components.utils.reportError("Error accessing account " + accountID + ": " + e);
+ Cu.reportError("Error accessing account " + accountID + ": " + e);
accountName = "Invalid account " + accountID;
panelsToKeep.length = 0;
}
// Create the top level tree-item.
var treeitem = document.createElement("treeitem");
mainTree.appendChild(treeitem);
var treerow = document.createElement("treerow");
--- a/mailnews/base/prefs/content/AccountWizard.js
+++ b/mailnews/base/prefs/content/AccountWizard.js
@@ -41,18 +41,18 @@ var okCallback = null;
*/
ChromeUtils.import("resource:///modules/mailServices.js");
var contentWindow;
var gPageData;
-var nsIMsgIdentity = Components.interfaces.nsIMsgIdentity;
-var nsIMsgIncomingServer = Components.interfaces.nsIMsgIncomingServer;
+var nsIMsgIdentity = Ci.nsIMsgIdentity;
+var nsIMsgIncomingServer = Ci.nsIMsgIncomingServer;
var gPrefsBundle, gMessengerBundle;
// the current nsIMsgAccount
var gCurrentAccount;
// default account
var gDefaultAccount;
@@ -268,17 +268,17 @@ function AccountDataToPageData(accountDa
var identity;
if (accountData.identity) {
dump("This is an accountdata\n");
identity = accountData.identity;
}
else if (accountData.identities) {
- identity = accountData.identities.queryElementAt(0, Components.interfaces.nsIMsgIdentity);
+ identity = accountData.identities.queryElementAt(0, Ci.nsIMsgIdentity);
dump("this is an account, id= " + identity + "\n");
}
setPageData(pageData, "identity", "email", identity.email || "");
setPageData(pageData, "identity", "fullName", identity.fullName || "");
var smtp;
@@ -443,17 +443,17 @@ function finishAccount(account, accountD
dump("srcServer.ServerType-" + srcServer.type + " = " +
srcServer["ServerType-" + srcServer.type] + "\n");
if (srcServer["ServerType-" + srcServer.type]) {
// handle server-specific stuff
var IID;
try {
IID = destServer.protocolInfo.serverIID;
} catch (ex) {
- Components.utils.reportError("Could not get IID for " + srcServer.type + ": " + ex);
+ Cu.reportError("Could not get IID for " + srcServer.type + ": " + ex);
}
if (IID) {
destProtocolServer = destServer.QueryInterface(IID);
srcProtocolServer = srcServer["ServerType-" + srcServer.type];
dump("Copying over " + srcServer.type + "-specific data\n");
copyObjectToInterface(destProtocolServer, srcProtocolServer, false);
@@ -607,17 +607,17 @@ function setupCopiesAndFoldersServer(acc
{
try {
var server = account.incomingServer;
// This function sets up the default send preferences. The send preferences
// go on identities, so there is no need to continue without any identities.
if (server.type == "rss" || account.identities.length == 0)
return false;
- let identity = account.identities.queryElementAt(0, Components.interfaces.nsIMsgIdentity);
+ let identity = account.identities.queryElementAt(0, Ci.nsIMsgIdentity);
// For this server, do we default the folder prefs to this server, or to the "Local Folders" server
// If it's deferred, we use the local folders account.
var defaultCopiesAndFoldersPrefsToServer = !accountIsDeferred && server.defaultCopiesAndFoldersPrefsToServer;
var copiesAndFoldersServer = null;
if (defaultCopiesAndFoldersPrefsToServer)
{
copiesAndFoldersServer = server;
@@ -659,17 +659,17 @@ function setDefaultCopiesAndFoldersPrefs
// this since we are creating the server, it obviously hasn't been
// opened, or in rdf.
//
// this makes the assumption that the server's draft, stationery fcc folder
// are at the top level (ie subfolders of the root folder.) this works
// because we happen to be doing things that way, and if the user changes
// that, it will work because to change the folder, it must be in rdf,
// coming from the folder cache, in the worst case.
- var msgFolder = rootFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
+ var msgFolder = rootFolder.QueryInterface(Ci.nsIMsgFolder);
/**
* When a new account is created, folders 'Sent', 'Drafts'
* and 'Templates' are not created then, but created on demand at runtime.
* But we do need to present them as possible choices in the Copies and Folders
* UI. To do that, folder URIs have to be created and stored in the prefs file.
* So, if there is a need to build special folders, append the special folder
* names and create right URIs.
--- a/mailnews/base/prefs/content/SmtpServerEdit.js
+++ b/mailnews/base/prefs/content/SmtpServerEdit.js
@@ -33,14 +33,14 @@ function onAccept()
try {
if (!gSmtpServer) {
gSmtpServer = MailServices.smtp.createServer();
window.arguments[0].addSmtpServer = gSmtpServer.key;
}
saveSmtpSettings(gSmtpServer);
} catch (ex) {
- Components.utils.reportError("Error saving smtp server: " + ex);
+ Cu.reportError("Error saving smtp server: " + ex);
}
window.arguments[0].result = true;
return true;
}
--- a/mailnews/base/prefs/content/accountUtils.js
+++ b/mailnews/base/prefs/content/accountUtils.js
@@ -13,50 +13,50 @@ var gAnyValidIdentity = false; //If ther
var gNewAccountToLoad = null; // used to load new messages if we come from the mail3pane
function getInvalidAccounts(accounts)
{
let numAccounts = accounts.length;
let invalidAccounts = new Array;
let numIdentities = 0;
for (let i = 0; i < numAccounts; i++) {
- let account = accounts.queryElementAt(i, Components.interfaces.nsIMsgAccount);
+ let account = accounts.queryElementAt(i, Ci.nsIMsgAccount);
try {
if (!account.incomingServer.valid) {
invalidAccounts[invalidAccounts.length] = account;
// skip to the next account
continue;
}
} catch (ex) {
// this account is busted, just keep going
continue;
}
var identities = account.identities;
numIdentities = identities.length;
for (var j = 0; j < numIdentities; j++) {
- let identity = identities.queryElementAt(j, Components.interfaces.nsIMsgIdentity);
+ let identity = identities.queryElementAt(j, Ci.nsIMsgIdentity);
if (identity.valid) {
gAnyValidIdentity = true;
}
else {
invalidAccounts[invalidAccounts.length] = account;
}
}
}
return invalidAccounts;
}
function showMailIntegrationDialog() {
- const nsIShellService = Components.interfaces.nsIShellService;
+ const nsIShellService = Ci.nsIShellService;
try {
- var shellService = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ var shellService = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
var appTypesCheck = shellService.shouldBeDefaultClientFor &
(nsIShellService.MAIL | nsIShellService.NEWS);
// show the default client dialog only if we have at least one account,
// if we should check for the default client, and we want to check if we are
// the default for mail/news and are not the default client for mail/news
if (appTypesCheck && shellService.shouldCheckDefaultClient &&
!shellService.isDefaultClient(true, appTypesCheck))
@@ -243,17 +243,17 @@ function MsgAccountManager(selectPage, a
if (!aServer) {
if (typeof GetSelectedMsgFolders === "function") {
let folders = GetSelectedMsgFolders();
if (folders.length > 0)
aServer = folders[0].server;
}
if (!aServer && (typeof GetDefaultAccountRootFolder === "function")) {
let folder = GetDefaultAccountRootFolder();
- if (folder instanceof Components.interfaces.nsIMsgFolder)
+ if (folder instanceof Ci.nsIMsgFolder)
aServer = folder.server;
}
}
window.openDialog("chrome://messenger/content/AccountManager.xul",
"AccountManager",
"chrome,centerscreen,modal,titlebar,resizable",
{ server: aServer, selectPage: selectPage });
@@ -261,17 +261,17 @@ function MsgAccountManager(selectPage, a
}
function loadInboxForNewAccount()
{
// gNewAccountToLoad is set in the final screen of the Account Wizard if a POP account
// was created, the download messages box is checked, and the wizard was opened from the 3pane
if (gNewAccountToLoad) {
var rootMsgFolder = gNewAccountToLoad.incomingServer.rootMsgFolder;
- const kInboxFlag = Components.interfaces.nsMsgFolderFlags.Inbox;
+ const kInboxFlag = Ci.nsMsgFolderFlags.Inbox;
var inboxFolder = rootMsgFolder.getFolderWithFlags(kInboxFlag);
SelectFolder(inboxFolder.URI);
window.focus();
setTimeout(MsgGetMessage, 0);
gNewAccountToLoad = null;
}
}
@@ -297,17 +297,17 @@ function migrateGlobalQuotingPrefs(allId
reply_on_top = Services.prefs.getIntPref("mailnews.reply_on_top");
auto_quote = Services.prefs.getBoolPref("mail.auto_quote");
} catch (ex) {}
if (!auto_quote || reply_on_top) {
let numIdentities = allIdentities.length;
var identity = null;
for (var j = 0; j < numIdentities; j++) {
- identity = allIdentities.queryElementAt(j, Components.interfaces.nsIMsgIdentity);
+ identity = allIdentities.queryElementAt(j, Ci.nsIMsgIdentity);
if (identity.valid) {
identity.autoQuote = auto_quote;
identity.replyOnTop = reply_on_top;
}
}
}
Services.prefs.setIntPref("mailnews.quotingPrefs.version", 1);
}
@@ -357,24 +357,24 @@ function NewMailAccountProvisioner(aMsgW
aMsgWindow = MailServices.mailSession.topmostMsgWindow;
args.msgWindow = aMsgWindow;
let mail3Pane = Services.wm.getMostRecentWindow("mail:3pane");
// If we couldn't find a 3pane, bail out.
if (!mail3Pane) {
- Components.utils.reportError("Could not find a 3pane to connect to.");
+ Cu.reportError("Could not find a 3pane to connect to.");
return;
}
let tabmail = mail3Pane.document.getElementById("tabmail");
if (!tabmail) {
- Components.utils.reportError("Could not find a tabmail in the 3pane!");
+ Cu.reportError("Could not find a tabmail in the 3pane!");
return;
}
// If there's already an accountProvisionerTab open, just focus it instead
// of opening a new dialog.
let apTab = tabmail.getTabInfoForCurrentOrFirstModeInstance(
tabmail.tabModes["accountProvisionerTab"]);
--- a/mailnews/base/prefs/content/am-copies.js
+++ b/mailnews/base/prefs/content/am-copies.js
@@ -412,17 +412,17 @@ function SetRadioButtons(selectPickerId,
* currently selected (Gmail IMAP folders should have the button disabled, since
* changing the archive hierarchy does nothing there.
*
* @param archiveFolder the currently-selected folder to store archives in
*/
function updateArchiveHierarchyButton(archiveFolder) {
let isGmailImap = (archiveFolder.server.type == "imap" &&
archiveFolder.server.QueryInterface(
- Components.interfaces.nsIImapIncomingServer)
+ Ci.nsIImapIncomingServer)
.isGMailServer);
document.getElementById("archiveHierarchyButton").disabled = isGmailImap;
}
/**
* Enable or disable (as appropriate) the controls for setting archive options
*/
function setupArchiveItems() {
--- a/mailnews/base/prefs/content/am-identities-list.js
+++ b/mailnews/base/prefs/content/am-identities-list.js
@@ -41,17 +41,17 @@ function refreshIdentityList(aSelectInde
{
// Remove all children.
while (gIdentityListBox.hasChildNodes())
gIdentityListBox.lastChild.remove();
// Build the list from the identities array.
let identities = gAccount.identities;
for (let identity of fixIterator(identities,
- Components.interfaces.nsIMsgIdentity))
+ Ci.nsIMsgIdentity))
{
if (identity.valid)
{
let listitem = document.createElement("listitem");
listitem.setAttribute("label", identity.identityName);
listitem.setAttribute("key", identity.key);
gIdentityListBox.appendChild(listitem);
}
@@ -89,17 +89,17 @@ function openIdentityEditor(identity)
function getSelectedIdentity()
{
if (gIdentityListBox.selectedItems.length != 1)
return null;
var identityKey = gIdentityListBox.selectedItems[0].getAttribute("key");
let identities = gAccount.identities;
for (let identity of fixIterator(identities,
- Components.interfaces.nsIMsgIdentity))
+ Ci.nsIMsgIdentity))
{
if (identity.valid && identity.key == identityKey)
return identity;
}
return null; // no identity found
}
--- a/mailnews/base/prefs/content/am-identity-edit.js
+++ b/mailnews/base/prefs/content/am-identity-edit.js
@@ -208,18 +208,18 @@ function saveIdentitySettings(identity)
identity.smtpServerKey = document.getElementById('identity.smtpServerKey').value;
var attachSignaturePath = document.getElementById('identity.signature').value;
identity.signature = null; // this is important so we don't accidentally inherit the default
if (attachSignaturePath)
{
// convert signature path back into a nsIFile
- var sfile = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(Components.interfaces.nsIFile);
+ var sfile = Cc["@mozilla.org/file/local;1"]
+ .createInstance(Ci.nsIFile);
sfile.initWithPath(attachSignaturePath);
if (sfile.exists())
identity.signature = sfile;
}
}
}
function saveCopiesAndFolderSettings(identity)
@@ -256,20 +256,20 @@ function saveAddressingAndCompositionSet
identity.replyOnTop = document.getElementById('identity.replyOnTop').value;
identity.sigBottom = document.getElementById('identity.sig_bottom').value == 'true';
identity.sigOnReply = document.getElementById('identity.sig_on_reply').checked;
identity.sigOnForward = document.getElementById('identity.sig_on_fwd').checked;
}
function selectFile()
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
+ const nsIFilePicker = Ci.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
var prefBundle = document.getElementById("bundle_prefs");
var title = prefBundle.getString("choosefile");
fp.init(window, title, nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterAll);
// Get current signature folder, if there is one.
// We can set that to be the initial folder so that users
@@ -292,17 +292,17 @@ function GetSigFolder()
try
{
var account = parent.getCurrentAccount();
var identity = account.defaultIdentity;
var signatureFile = identity.signature;
if (signatureFile)
{
- signatureFile = signatureFile.QueryInterface(Components.interfaces.nsIFile);
+ signatureFile = signatureFile.QueryInterface(Ci.nsIFile);
sigFolder = signatureFile.parent;
if (!sigFolder.exists())
sigFolder = null;
}
}
catch (ex) {
dump("failed to get signature folder..\n");
@@ -383,17 +383,17 @@ function loadSMTPServerList()
var smtpPopup = smtpServerList.menupopup;
while (smtpPopup.lastChild.nodeName != "menuseparator")
smtpPopup.lastChild.remove();
while (servers.hasMoreElements())
{
var server = servers.getNext();
- if (server instanceof Components.interfaces.nsISmtpServer)
+ if (server instanceof Ci.nsISmtpServer)
{
var serverName = "";
if (server.description)
serverName = server.description + ' - ';
else if (server.username)
serverName = server.username + ' - ';
serverName += server.hostname;
--- a/mailnews/base/prefs/content/am-junk.js
+++ b/mailnews/base/prefs/content/am-junk.js
@@ -60,17 +60,17 @@ function onInit(aPageId, aServerId)
// Ensure the whitelist is empty
for (let i = wList.itemCount - 1; i >= 0; i--) {
wList.removeItemAt(i);
}
// Populate the listbox with address books
let abItems = [];
for (let ab of fixIterator(MailServices.ab.directories,
- Components.interfaces.nsIAbDirectory)) {
+ Ci.nsIAbDirectory)) {
// We skip mailing lists and remote address books.
if (ab.isMailList || ab.isRemote)
continue;
abItems.push({ label: ab.dirName, URI: ab.URI });
}
// Sort the list
@@ -236,23 +236,23 @@ function buildServerFilterMenuList()
const KEY_ISP_DIRECTORY_LIST = "ISPDL";
let ispHeaderList = document.getElementById("useServerFilterList");
// Ensure the menulist is empty.
ispHeaderList.removeAllItems();
// Now walk through the isp directories looking for sfd files.
let ispDirectories = Services.dirsvc.get(KEY_ISP_DIRECTORY_LIST,
- Components.interfaces.nsISimpleEnumerator);
+ Ci.nsISimpleEnumerator);
let menuEntries = [];
while (ispDirectories.hasMoreElements())
{
let ispDirectory = ispDirectories.getNext()
- .QueryInterface(Components.interfaces.nsIFile);
+ .QueryInterface(Ci.nsIFile);
if (ispDirectory)
menuEntries.push.apply(menuEntries, buildServerFilterListFromDir(ispDirectory, menuEntries));
}
menuEntries.sort((a, b) => a.localeCompare(b));
for (let entry of menuEntries) {
ispHeaderList.appendItem(entry, entry);
}
@@ -267,17 +267,17 @@ function buildServerFilterMenuList()
* @param aExistingEntries Filter names already found.
*/
function buildServerFilterListFromDir(aDir, aExistingEntries)
{
let newEntries = [];
// Now iterate over each file in the directory looking for .sfd files.
const kSuffix = ".sfd";
let entries = aDir.directoryEntries
- .QueryInterface(Components.interfaces.nsIDirectoryEnumerator);
+ .QueryInterface(Ci.nsIDirectoryEnumerator);
while (entries.hasMoreElements()) {
let entry = entries.nextFile;
// we only care about files that end in .sfd
if (entry.isFile() && entry.leafName.endsWith(kSuffix)) {
let fileName = entry.leafName.slice(0, -kSuffix.length);
// If we've already added an item with this name, then don't add it again.
if (aExistingEntries.indexOf(fileName) == -1)
--- a/mailnews/base/prefs/content/am-offline.js
+++ b/mailnews/base/prefs/content/am-offline.js
@@ -46,17 +46,17 @@ function initServerSettings()
document.getElementById("offline.notDownload").checked = gIncomingServer.limitOfflineMessageSize;
document.getElementById("autosync.notDownload").checked = gIncomingServer.limitOfflineMessageSize;
if(gIncomingServer.maxMessageSize > 0)
document.getElementById("offline.notDownloadMin").value = gIncomingServer.maxMessageSize;
else
document.getElementById("offline.notDownloadMin").value = "50";
if(gServerType == "imap") {
- gImapIncomingServer = gIncomingServer.QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ gImapIncomingServer = gIncomingServer.QueryInterface(Ci.nsIImapIncomingServer);
document.getElementById("offline.folders").checked = gImapIncomingServer.offlineDownload;
}
}
function initRetentionSettings()
{
let retentionSettings = gIncomingServer.retentionSettings;
initCommonRetentionSettings(retentionSettings);
@@ -132,17 +132,17 @@ function onPreInit(account, accountValue
"prefPanel-synchronization" : "prefPanel-diskspace";
var prefBundle = document.getElementById("bundle_prefs");
var headertitle = document.getElementById("headertitle");
headertitle.setAttribute('title',prefBundle.getString(titleStringID));
document.title = prefBundle.getString(titleStringID);
if (gServerType == "pop3") {
- var pop3Server = gIncomingServer.QueryInterface(Components.interfaces.nsIPop3IncomingServer);
+ var pop3Server = gIncomingServer.QueryInterface(Ci.nsIPop3IncomingServer);
// hide retention settings for deferred accounts
if (pop3Server.deferredToAccount.length) {
var retentionRadio = document.getElementById("retention.keepMsg");
retentionRadio.setAttribute("hidden", "true");
var retentionLabel = document.getElementById("retentionDescriptionPop");
retentionLabel.setAttribute("hidden", "true");
var applyToFlaggedCheckbox = document.getElementById("retention.applyToFlagged");
applyToFlaggedCheckbox.setAttribute("hidden", "true");
@@ -212,19 +212,19 @@ function onCancel()
/**
* Prompt to avoid unexpected folder sync changes.
*/
function onLeave()
{
let changed = false;
if (gToggleOccurred) {
let allFolders = gIncomingServer.rootFolder.descendants;
- for (let folder of fixIterator(allFolders, Components.interfaces.nsIMsgFolder)) {
+ for (let folder of fixIterator(allFolders, Ci.nsIMsgFolder)) {
if (gOfflineMap[folder.folderURL] !=
- folder.getFlag(Components.interfaces.nsMsgFolderFlags.Offline)) {
+ folder.getFlag(Ci.nsMsgFolderFlags.Offline)) {
// A change to the Offline flag to a folder was made.
changed = true;
break;
}
}
gToggleOccurred = false;
}
@@ -251,18 +251,18 @@ function onLeave()
}
}
return true;
}
function onSave()
{
var downloadSettings =
- Components.classes["@mozilla.org/msgDatabase/downloadSettings;1"]
- .createInstance(Components.interfaces.nsIMsgDownloadSettings);
+ Cc["@mozilla.org/msgDatabase/downloadSettings;1"]
+ .createInstance(Ci.nsIMsgDownloadSettings);
gIncomingServer.limitOfflineMessageSize = document.getElementById("offline.notDownload").checked;
gIncomingServer.maxMessageSize = document.getElementById("offline.notDownloadMin").value;
var retentionSettings = saveCommonRetentionSettings(gIncomingServer.retentionSettings);
retentionSettings.daysToKeepBodies = document.getElementById("nntp.removeBodyMin").value;
retentionSettings.cleanupBodiesByDays = document.getElementById("nntp.removeBody").checked;
@@ -346,43 +346,43 @@ function onCheckItem(changeElementId, ch
element.setAttribute("disabled", "true");
}
}
function toggleOffline()
{
let offline = document.getElementById("offline.folders").checked;
let allFolders = gIncomingServer.rootFolder.descendants;
- for (let folder of fixIterator(allFolders, Components.interfaces.nsIMsgFolder)) {
+ for (let folder of fixIterator(allFolders, Ci.nsIMsgFolder)) {
if (offline)
- folder.setFlag(Components.interfaces.nsMsgFolderFlags.Offline);
+ folder.setFlag(Ci.nsMsgFolderFlags.Offline);
else
- folder.clearFlag(Components.interfaces.nsMsgFolderFlags.Offline);
+ folder.clearFlag(Ci.nsMsgFolderFlags.Offline);
}
gToggleOccurred = true;
}
function collectOfflineFolders()
{
let offlineFolderMap = {};
let allFolders = gIncomingServer.rootFolder.descendants;
- for (let folder of fixIterator(allFolders, Components.interfaces.nsIMsgFolder))
- offlineFolderMap[folder.folderURL] = folder.getFlag(Components.interfaces.nsMsgFolderFlags.Offline);
+ for (let folder of fixIterator(allFolders, Ci.nsIMsgFolder))
+ offlineFolderMap[folder.folderURL] = folder.getFlag(Ci.nsMsgFolderFlags.Offline);
return offlineFolderMap;
}
function restoreOfflineFolders(offlineFolderMap)
{
let allFolders = gIncomingServer.rootFolder.descendants;
- for (let folder of fixIterator(allFolders, Components.interfaces.nsIMsgFolder)) {
+ for (let folder of fixIterator(allFolders, Ci.nsIMsgFolder)) {
if (offlineFolderMap[folder.folderURL])
- folder.setFlag(Components.interfaces.nsMsgFolderFlags.Offline);
+ folder.setFlag(Ci.nsMsgFolderFlags.Offline);
else
- folder.clearFlag(Components.interfaces.nsMsgFolderFlags.Offline);
+ folder.clearFlag(Ci.nsMsgFolderFlags.Offline);
}
}
/**
* Checks if the user selected a permanent removal of messages from a server
* listed in the confirmfor attribute and warns about it.
*
* @param aRadio The radiogroup element containing the retention options.
--- a/mailnews/base/prefs/content/am-prefs.js
+++ b/mailnews/base/prefs/content/am-prefs.js
@@ -94,17 +94,17 @@ function onCheckItem(aChangeElementId, a
for (let notifyId of aCheckElementIds) {
let notifyElement = document.getElementById(notifyId);
let notifyElementState = null;
if ("checked" in notifyElement)
notifyElementState = notifyElement.checked;
else if ("selected" in notifyElement)
notifyElementState = notifyElement.selected;
else
- Components.utils.reportError("Unknown type of control element: " + notifyElement.id);
+ Cu.reportError("Unknown type of control element: " + notifyElement.id);
if (!notifyElementState) {
disabled = true;
break;
}
}
if (!disabled && getAccountValueIsLocked(elementToControl))
--- a/mailnews/base/prefs/content/am-server.js
+++ b/mailnews/base/prefs/content/am-server.js
@@ -160,17 +160,17 @@ function onAdvanced()
document.getElementById("imap.serverDirectory").setAttribute("value", serverSettings.serverDirectory);
document.getElementById("imap.otherUsersNamespace").setAttribute("value", serverSettings.otherUsersNamespace);
document.getElementById("imap.overrideNamespaces").checked = serverSettings.overrideNamespaces;
}
else if (serverType == "pop3")
{
document.getElementById("pop3.deferGetNewMail").checked = serverSettings.deferGetNewMail;
document.getElementById("pop3.deferredToAccount").setAttribute("value", serverSettings.deferredToAccount);
- let pop3Server = gServer.QueryInterface(Components.interfaces.nsIPop3IncomingServer);
+ let pop3Server = gServer.QueryInterface(Ci.nsIPop3IncomingServer);
// we're explicitly setting this so we'll go through the SetDeferredToAccount method
pop3Server.deferredToAccount = serverSettings.deferredToAccount;
// Setting the server to be deferred causes a rebuild of the account tree,
// losing the current selection. Reselect the current server again as it
// didn't really disappear.
parent.selectServer(parent.getCurrentAccount().incomingServer, parent.currentPageId);
// Iterate over all accounts to see if any of their junk targets are now
@@ -180,17 +180,17 @@ function onAdvanced()
// to that folder (moveOnSpam = true) then moving junk is disabled
// (so that the user notices it and checks the settings).
// This is the same sanitization as in am-junk.js, just applied to all POP accounts.
let deferredURI = serverSettings.deferredToAccount &&
MailServices.accounts.getAccount(serverSettings.deferredToAccount)
.incomingServer.serverURI;
for (let account of fixIterator(MailServices.accounts.accounts,
- Components.interfaces.nsIMsgAccount)) {
+ Ci.nsIMsgAccount)) {
let accountValues = parent.getValueArrayFor(account);
let type = parent.getAccountValue(account, accountValues, "server", "type",
null, false);
// Try to keep this list of account types not having Junk settings
// synchronized with the list in AccountManager.js.
if (type != "nntp" && type != "rss" && type != "im") {
let spamActionTargetAccount = parent.getAccountValue(account, accountValues,
"server", "spamActionTargetAccount", "string", true);
@@ -273,29 +273,29 @@ function setupFixedUI()
fixedElement.setAttribute("collapsed", "true");
otherElement.removeAttribute("collapsed");
}
}
function BrowseForNewsrc()
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- const nsIFile = Components.interfaces.nsIFile;
+ const nsIFilePicker = Ci.nsIFilePicker;
+ const nsIFile = Ci.nsIFile;
var newsrcTextBox = document.getElementById("nntp.newsrcFilePath");
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window,
document.getElementById("browseForNewsrc").getAttribute("filepickertitle"),
nsIFilePicker.modeSave);
var currentNewsrcFile;
try {
- currentNewsrcFile = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(nsIFile);
+ currentNewsrcFile = Cc["@mozilla.org/file/local;1"]
+ .createInstance(nsIFile);
currentNewsrcFile.initWithPath(newsrcTextBox.value);
} catch (e) {
dump("Failed to create nsIFile instance for the current newsrc file.\n");
}
if (currentNewsrcFile) {
fp.displayDirectory = currentNewsrcFile.parent;
fp.defaultString = currentNewsrcFile.leafName;
@@ -322,18 +322,18 @@ function setupImapDeleteUI(aServerId)
// set folderPicker menulist
var trashPopup = document.getElementById("msgTrashFolderPopup");
trashPopup._teardown();
trashPopup._parentFolder = MailUtils.getFolderForURI(aServerId);
trashPopup._ensureInitialized();
// Convert the folder path in Unicode to MUTF-7.
- let manager = Components.classes['@mozilla.org/charset-converter-manager;1']
- .getService(Components.interfaces.nsICharsetConverterManager);
+ let manager = Cc['@mozilla.org/charset-converter-manager;1']
+ .getService(Ci.nsICharsetConverterManager);
// Escape backslash and double-quote with another backslash before encoding.
let trashMutf7 = manager.unicodeToMutf7(trashFolderName.replace(/([\\"])/g, '\\$1'));
// TODO: There is something wrong here, selectFolder() fails even if the
// folder does exist. Try to fix in bug 802609.
let trashFolder = MailUtils.getFolderForURI(aServerId + "/" + trashMutf7, false);
try {
trashPopup.selectFolder(trashFolder);
} catch(ex) {
@@ -371,22 +371,22 @@ function selectImapDeleteModel(choice)
function folderPickerChange(aEvent)
{
var folder = aEvent.target._folder;
// Since we need to deal with localised folder names, we simply use
// the path of the URI like we do in nsImapIncomingServer::DiscoveryDone().
// Note that the path is returned with a leading slash which we need to remove.
var folderPath = Services.io.newURI(folder.URI).pathQueryRef.substring(1);
// We need to convert that from MUTF-7 to Unicode.
- var manager = Components.classes['@mozilla.org/charset-converter-manager;1']
- .getService(Components.interfaces.nsICharsetConverterManager);
- var util = Components.classes["@mozilla.org/network/util;1"]
- .getService(Components.interfaces.nsINetUtil);
+ var manager = Cc['@mozilla.org/charset-converter-manager;1']
+ .getService(Ci.nsICharsetConverterManager);
+ var util = Cc["@mozilla.org/network/util;1"]
+ .getService(Ci.nsINetUtil);
var trashUnicode = manager.mutf7ToUnicode(
- util.unescapeString(folderPath, Components.interfaces.nsINetUtil.ESCAPE_URL_PATH));
+ util.unescapeString(folderPath, Ci.nsINetUtil.ESCAPE_URL_PATH));
// Set the value to be persisted.
document.getElementById("imap.trashFolderName")
.setAttribute("value", trashUnicode);
// Update the widget to show/do correct things even for subfolders.
var trashFolderPicker = document.getElementById("msgTrashFolderPicker");
trashFolderPicker.menupopup.selectFolder(folder);
--- a/mailnews/base/prefs/content/am-smtp.js
+++ b/mailnews/base/prefs/content/am-smtp.js
@@ -109,18 +109,18 @@ var gSmtpServerListWindow =
document.getElementById('nameValue').value = aServer.hostname;
document.getElementById('descriptionValue').value = aServer.description || noneSelected;
document.getElementById('portValue').value = aServer.port;
document.getElementById('userNameValue').value = aServer.username || noneSelected;
document.getElementById('useSecureConnectionValue').value =
this.mBundle.getString("smtpServer-ConnectionSecurityType-" +
aServer.socketType);
- const AuthMethod = Components.interfaces.nsMsgAuthMethod;
- const SocketType = Components.interfaces.nsMsgSocketType;
+ const AuthMethod = Ci.nsMsgAuthMethod;
+ const SocketType = Ci.nsMsgSocketType;
var authStr = "";
switch (aServer.authMethod)
{
case AuthMethod.none:
authStr = "authNo";
break;
case AuthMethod.passwordEncrypted:
authStr = "authPasswordEncrypted";
@@ -140,17 +140,17 @@ var gSmtpServerListWindow =
? "authPasswordCleartextViaSSL"
: "authPasswordCleartextInsecurely";
break;
case AuthMethod.OAuth2:
authStr = "authOAuth2";
break;
default:
// leave empty
- Components.utils.reportError("Warning: unknown value for smtpserver... authMethod: " +
+ Cu.reportError("Warning: unknown value for smtpserver... authMethod: " +
aServer.authMethod);
}
if (authStr)
document.getElementById("authMethodValue").value =
this.mBundle.getString(authStr);
},
refreshServerList: function(aServerKeyToSelect, aFocusList)
@@ -176,17 +176,17 @@ var gSmtpServerListWindow =
{
if (!aListBox || !aServers)
return;
while (aServers.hasMoreElements())
{
var server = aServers.getNext();
- if (server instanceof Components.interfaces.nsISmtpServer)
+ if (server instanceof Ci.nsISmtpServer)
{
var isDefault = (aDefaultServer.key == server.key);
var listitem = this.createSmtpListItem(server, isDefault);
aListBox.appendChild(listitem);
}
}
},
--- a/mailnews/base/prefs/content/amUtils.js
+++ b/mailnews/base/prefs/content/amUtils.js
@@ -5,30 +5,30 @@
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource:///modules/MailUtils.js");
ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
function BrowseForLocalFolders()
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- const nsIFile = Components.interfaces.nsIFile;
+ const nsIFilePicker = Ci.nsIFilePicker;
+ const nsIFile = Ci.nsIFile;
var currentFolderTextBox = document.getElementById("server.localPath");
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
fp.init(window,
document.getElementById("browseForLocalFolder")
.getAttribute("filepickertitle"),
nsIFilePicker.modeGetFolder);
- var currentFolder = Components.classes["@mozilla.org/file/local;1"]
- .createInstance(nsIFile);
+ var currentFolder = Cc["@mozilla.org/file/local;1"]
+ .createInstance(nsIFile);
currentFolder.initWithPath(currentFolderTextBox.value);
fp.displayDirectory = currentFolder;
fp.open(rv => {
if (rv != nsIFilePicker.returnOK || !fp.file) {
return;
}
// Retrieve the selected folder.
@@ -190,17 +190,17 @@ function openPrefsFromAccountManager(aTB
*
* @param aAccountName The account name string to look for.
* @param aAccountKey Optional. The key of an account that is skipped when
* searching the name. If unset, do not skip any account.
*/
function accountNameExists(aAccountName, aAccountKey)
{
for (let account of fixIterator(MailServices.accounts.accounts,
- Components.interfaces.nsIMsgAccount))
+ Ci.nsIMsgAccount))
{
if (account.key != aAccountKey && account.incomingServer &&
aAccountName == account.incomingServer.prettyName) {
return true;
}
}
return false;
--- a/mailnews/base/prefs/content/aw-identity.js
+++ b/mailnews/base/prefs/content/aw-identity.js
@@ -179,17 +179,17 @@ function checkForDomain()
postEmailText.setAttribute("value", "@" + gCurrentDomain);
postEmailText.hidden = false;
}
function checkForFullName() {
var name = document.getElementById("fullName");
if (name.value=="") {
try {
- var userInfo = Components.classes["@mozilla.org/userinfo;1"].getService(Components.interfaces.nsIUserInfo);
+ var userInfo = Cc["@mozilla.org/userinfo;1"].getService(Ci.nsIUserInfo);
name.value = userInfo.fullname;
}
catch (ex) {
// dump ("checkForFullName failed: " + ex + "\n");
}
}
}
@@ -197,16 +197,16 @@ function checkForEmail()
{
var email = document.getElementById("email");
var pageData = parent.GetPageData();
if (pageData && pageData.identity && pageData.identity.email) {
email.value = pageData.identity.email.value;
}
if (email.value=="") {
try {
- var userInfo = Components.classes["@mozilla.org/userinfo;1"].getService(Components.interfaces.nsIUserInfo);
+ var userInfo = Cc["@mozilla.org/userinfo;1"].getService(Ci.nsIUserInfo);
email.value = userInfo.emailAddress;
}
catch (ex) {
// dump ("checkForEmail failed: " + ex + "\n");
}
}
}
--- a/mailnews/base/prefs/content/aw-incoming.js
+++ b/mailnews/base/prefs/content/aw-incoming.js
@@ -133,18 +133,18 @@ function incomingPageInit() {
var incomingServerTextBox = document.getElementById("incomingServer");
if (incomingServerTextBox && incomingServerTextBox.value == "")
incomingServerTextBox.value = pageData.server.hostname.value;
}
// pageData.server is not a real nsMsgIncomingServer so it does not have
// protocolInfo property implemented.
let type = parent.getCurrentServerType(pageData);
- gProtocolInfo = Components.classes["@mozilla.org/messenger/protocol/info;1?type=" + type]
- .getService(Components.interfaces.nsIMsgProtocolInfo);
+ gProtocolInfo = Cc["@mozilla.org/messenger/protocol/info;1?type=" + type]
+ .getService(Ci.nsIMsgProtocolInfo);
var loginNameInput = document.getElementById("username");
if (loginNameInput.value == "") {
if (gProtocolInfo.requiresUsername) {
// since we require a username, use the uid from the email address
loginNameInput.value = parent.getUsernameFromEmail(pageData.identity.email.value, gCurrentAccountData &&
gCurrentAccountData.incomingServerUserNameRequiresDomain);
}
--- a/mailnews/base/prefs/content/ispUtils.js
+++ b/mailnews/base/prefs/content/ispUtils.js
@@ -1,30 +1,30 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// using the rdf service extensively here
-var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
+var rdf = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
// all the RDF resources we'll be retrieving
var NC = "http://home.netscape.com/NC-rdf#";
var Server = rdf.GetResource(NC + "Server");
var SmtpServer = rdf.GetResource(NC + "SmtpServer");
var ServerHost = rdf.GetResource(NC + "ServerHost");
var ServerType = rdf.GetResource(NC + "ServerType");
var PrefixIsUsername = rdf.GetResource(NC + "PrefixIsUsername");
var UseAuthenticatedSmtp= rdf.GetResource(NC + "UseAuthenticatedSmtp");
// this is possibly expensive, not sure what to do here
var ispDefaults;
-var nsIRDFResource = Components.interfaces.nsIRDFResource;
-var nsIRDFLiteral = Components.interfaces.nsIRDFLiteral;
+var nsIRDFResource = Ci.nsIRDFResource;
+var nsIRDFLiteral = Ci.nsIRDFLiteral;
var ispRoot = rdf.GetResource("NC:ispinfo");
// given an ISP's domain URI, look up all relevant information about it
function getIspDefaultsForUri(domainURI)
{
if (!ispDefaults)
ispDefaults = rdf.GetDataSource("rdf:ispdefaults");
--- a/mailnews/base/prefs/content/removeAccount.js
+++ b/mailnews/base/prefs/content/removeAccount.js
@@ -19,23 +19,23 @@ function onLoad(event) {
document.getElementById("accountName").textContent = removeQuestion;
// Allow to remove account data if it has a local storage.
let localDirectory = gServer.localPath;
if (localDirectory && localDirectory.exists()) {
localDirectory.normalize();
// Do not allow removal if localPath is outside of profile folder.
- let profilePath = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ let profilePath = Services.dirsvc.get("ProfD", Ci.nsIFile);
profilePath.normalize();
// TODO: bug 77652, decide what to do for deferred accounts.
// And inform the user if the account localPath is outside the profile.
if ((gServer.isDeferredTo ||
- (gServer instanceof Components.interfaces.nsIPop3IncomingServer &&
+ (gServer instanceof Ci.nsIPop3IncomingServer &&
gServer.deferredToAccount)) ||
!profilePath.contains(localDirectory)) {
document.getElementById("removeData").disabled = true;
}
} else {
document.getElementById("removeDataPossibility").collapsed = true;
}
@@ -111,17 +111,17 @@ function removeAccount() {
window.arguments[0].result = false;
}
document.getElementById("status").selectedPanel =
document.getElementById("success");
} catch (ex) {
document.getElementById("status").selectedPanel =
document.getElementById("failure");
- Components.utils.reportError("Failure to remove account: " + ex);
+ Cu.reportError("Failure to remove account: " + ex);
window.arguments[0].result = false;
}
}
function onAccept() {
// If Cancel is disabled, we already tried to remove the account
// and can only close the dialog.
if (gDialog.getButton("cancel").disabled)
--- a/mailnews/base/prefs/content/smtpEditOverlay.js
+++ b/mailnews/base/prefs/content/smtpEditOverlay.js
@@ -93,17 +93,17 @@ function onLockPreference()
hostname: gSmtpHostname,
description: gSmtpDescription,
port: gSmtpPort,
authMethod: gSmtpAuthMethod,
try_ssl: gSmtpSocketType
};
disableIfLocked(allPrefElements);
} catch (e) { // non-fatal
- Components.utils.reportError("Error while getting locked prefs: " + e);
+ Cu.reportError("Error while getting locked prefs: " + e);
}
}
/**
* Does the work of disabling an element given the array which contains xul id/prefstring pairs.
*
* @param prefstrArray array of XUL elements to check
*
--- a/mailnews/base/search/content/CustomHeaders.js
+++ b/mailnews/base/search/content/CustomHeaders.js
@@ -74,17 +74,17 @@ function onOk()
}
window.arguments[0].selectedVal = gHdrsList.selectedItem ? gHdrsList.selectedItem.label : null;
return true;
}
function customHeaderOverflow()
{
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
+ var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
if (gArrayHdrs.length >= (nsMsgSearchAttrib.kNumMsgSearchAttributes - nsMsgSearchAttrib.OtherHeader - 1))
{
if (!gFilterBundle)
gFilterBundle = document.getElementById("bundle_filter");
var alertText = gFilterBundle.getString("customHeaderOverflow");
Services.prompt.alert(window, null, alertText);
return true;
--- a/mailnews/base/search/content/FilterEditor.js
+++ b/mailnews/base/search/content/FilterEditor.js
@@ -32,20 +32,20 @@ var gFilterActionStrings = ["none", "mov
// A temporary filter with the current state of actions in the UI.
var gTempFilter = null;
// A nsIArray of the currently defined actions in the order they will be run.
var gActionListOrdered = null;
var gFilterEditorMsgWindow = null;
-var nsMsgFilterAction = Components.interfaces.nsMsgFilterAction;
-var nsMsgFilterType = Components.interfaces.nsMsgFilterType;
-var nsIMsgRuleAction = Components.interfaces.nsIMsgRuleAction;
-var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
+var nsMsgFilterAction = Ci.nsMsgFilterAction;
+var nsMsgFilterType = Ci.nsMsgFilterType;
+var nsIMsgRuleAction = Ci.nsIMsgRuleAction;
+var nsMsgSearchScope = Ci.nsMsgSearchScope;
function filterEditorOnLoad()
{
getCustomActions();
initializeSearchWidgets();
initializeFilterWidgets();
gFilterBundle = document.getElementById("bundle_filter");
@@ -85,28 +85,28 @@ function filterEditorOnLoad()
gPreFillName = args.filterName;
// Passing null as the parameter to createFilter to keep the name empty
// until later where we assign the name.
gFilter = gFilterList.createFilter(null);
var term = gFilter.createTerm();
- term.attrib = Components.interfaces.nsMsgSearchAttrib.Default;
+ term.attrib = Ci.nsMsgSearchAttrib.Default;
if (("fieldName" in args) && args.fieldName) {
// fieldName should contain the name of the field in which to search,
// from nsMsgSearchTerm.cpp::SearchAttribEntryTable, e.g. "to" or "cc"
try {
term.attrib = term.getAttributeFromString(args.fieldName);
} catch (e) { /* Invalid string is fine, just ignore it. */ }
}
- if (term.attrib == Components.interfaces.nsMsgSearchAttrib.Default)
- term.attrib = Components.interfaces.nsMsgSearchAttrib.Sender;
+ if (term.attrib == Ci.nsMsgSearchAttrib.Default)
+ term.attrib = Ci.nsMsgSearchAttrib.Sender;
- term.op = Components.interfaces.nsMsgSearchOp.Is;
+ term.op = Ci.nsMsgSearchOp.Is;
term.booleanAnd = gSearchBooleanRadiogroup.value == "and";
var termValue = term.value;
termValue.attrib = term.attrib;
termValue.str = gPreFillName;
term.value = termValue;
@@ -135,17 +135,17 @@ function filterEditorOnLoad()
let filterAction = copiedFilter.getActionAt(i);
newFilter.appendAction(filterAction);
}
// copy the search terms
for (let i = 0; i < copiedFilter.searchTerms.length; i++)
{
let searchTerm = copiedFilter.searchTerms.queryElementAt(i,
- Components.interfaces.nsIMsgSearchTerm);
+ Ci.nsIMsgSearchTerm);
var newTerm = newFilter.createTerm();
newTerm.attrib = searchTerm.attrib;
newTerm.op = searchTerm.op;
newTerm.booleanAnd = searchTerm.booleanAnd;
newTerm.value = searchTerm.value;
newFilter.appendTerm(newTerm);
};
@@ -200,17 +200,17 @@ function onEnterInSearchTerm(event)
}
}
function onAccept()
{
try {
if (!saveFilter())
return false;
- } catch(e) {Components.utils.reportError(e); return false;}
+ } catch(e) {Cu.reportError(e); return false;}
// parent should refresh filter list..
// this should REALLY only happen when some criteria changes that
// are displayed in the filter dialog, like the filter name
window.arguments[0].refresh = true;
window.arguments[0].newFilter = gFilter;
return true;
}
@@ -453,41 +453,41 @@ function saveFilter()
continue;
if (isNaN(obj.searchattribute.value)) // is this a custom term?
{
let customTerm = MailServices.filters.getCustomTerm(obj.searchattribute.value);
if (!customTerm)
{
invalidRule = true;
- Components.utils.reportError("Filter not saved because custom search term '" +
- obj.searchattribute.value + "' in rule " + rule_desc(index, obj) + " not found");
+ Cu.reportError("Filter not saved because custom search term '" +
+ obj.searchattribute.value + "' in rule " + rule_desc(index, obj) + " not found");
}
else
{
if (!customTerm.getAvailable(obj.searchScope, obj.searchattribute.value))
{
invalidRule = true;
- Components.utils.reportError("Filter not saved because custom search term '" +
- customTerm.name + "' in rule " + rule_desc(index, obj) + " not available");
+ Cu.reportError("Filter not saved because custom search term '" +
+ customTerm.name + "' in rule " + rule_desc(index, obj) + " not available");
}
}
}
else
{
- let otherHeader = Components.interfaces.nsMsgSearchAttrib.OtherHeader;
+ let otherHeader = Ci.nsMsgSearchAttrib.OtherHeader;
let attribValue = (obj.searchattribute.value > otherHeader) ?
otherHeader : obj.searchattribute.value;
if (!obj.searchattribute
.validityTable
.getAvailable(attribValue, obj.searchoperator.value))
{
invalidRule = true;
- Components.utils.reportError("Filter not saved because standard search term '" +
- attribValue + "' in rule " + rule_desc(index, obj) + " not available in this context");
+ Cu.reportError("Filter not saved because standard search term '" +
+ attribValue + "' in rule " + rule_desc(index, obj) + " not available in this context");
}
}
if (invalidRule) {
Services.prompt.alert(window,
gFilterBundle.getString("searchTermsInvalidTitle"),
gFilterBundle.getFormattedString("searchTermsInvalidRule",
[obj.searchattribute.label,
@@ -636,17 +636,17 @@ function AssignMeaningfulName()
stub = gFilterBundle.getString( "matchAllFilterName" );
else
{
// Assign a name based on the first search term.
let searchValue = termRoot.searchvalue;
let selIndex = searchValue.getAttribute( "selectedIndex" );
let children = document.getAnonymousNodes(searchValue);
let activeItem = children[selIndex];
- let attribs = Components.interfaces.nsMsgSearchAttrib;
+ let attribs = Ci.nsMsgSearchAttrib;
// Term, Operator and Value are the three parts of a filter match
// Term and Operator are easy to retrieve
let term = termRoot.searchattribute.label;
let operator = termRoot.searchoperator.label;
// Values are either popup menu items or edit fields.
// For popup menus use activeItem.label; for
@@ -711,31 +711,31 @@ function GetFirstSelectedMsgFolder()
}
function SearchNewFolderOkCallback(name, uri)
{
var msgFolder = MailUtils.getFolderForURI(uri, true);
var imapFolder = null;
try
{
- imapFolder = msgFolder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ imapFolder = msgFolder.QueryInterface(Ci.nsIMsgImapMailFolder);
}
catch(ex) {}
if (imapFolder) //imapFolder creation is asynchronous.
{
if (!gSessionFolderListenerAdded) {
try
{
- let notifyFlags = Components.interfaces.nsIFolderListener.event;
+ let notifyFlags = Ci.nsIFolderListener.event;
MailServices.mailSession.AddFolderListener(gFolderListener, notifyFlags);
gSessionFolderListenerAdded = true;
}
catch (ex)
{
- Components.utils.reportError("Error adding to session: " + ex + "\n");
+ Cu.reportError("Error adding to session: " + ex + "\n");
}
}
}
var msgWindow = GetFilterEditorMsgWindow();
if (imapFolder)
SetBusyCursor(window, true);
@@ -756,20 +756,20 @@ function UpdateAfterCustomHeaderChange()
}
//if you use msgWindow, please make sure that destructor gets called when you close the "window"
function GetFilterEditorMsgWindow()
{
if (!gFilterEditorMsgWindow)
{
var msgWindowContractID = "@mozilla.org/messenger/msgwindow;1";
- var nsIMsgWindow = Components.interfaces.nsIMsgWindow;
- gFilterEditorMsgWindow = Components.classes[msgWindowContractID].createInstance(nsIMsgWindow);
+ var nsIMsgWindow = Ci.nsIMsgWindow;
+ gFilterEditorMsgWindow = Cc[msgWindowContractID].createInstance(nsIMsgWindow);
gFilterEditorMsgWindow.domWindow = window;
- gFilterEditorMsgWindow.rootDocShell.appType = Components.interfaces.nsIDocShell.APP_TYPE_MAIL;
+ gFilterEditorMsgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
}
return gFilterEditorMsgWindow;
}
function SetBusyCursor(window, enable)
{
// setCursor() is only available for chrome windows.
// However one of our frames is the start page which
@@ -792,17 +792,17 @@ function doHelpButton()
function getCustomActions()
{
if (!gCustomActions)
{
gCustomActions = [];
let customActionsEnum = MailServices.filters.getCustomActions();
while (customActionsEnum.hasMoreElements())
gCustomActions.push(customActionsEnum.getNext().QueryInterface(
- Components.interfaces.nsIMsgFilterCustomAction));
+ Ci.nsIMsgFilterCustomAction));
}
}
function updateFilterType()
{
gFilterType = gFilterTypeSelector.getType();
setFilterScope(gFilterType, gFilterList);
--- a/mailnews/base/search/content/searchTermOverlay.js
+++ b/mailnews/base/search/content/searchTermOverlay.js
@@ -35,17 +35,17 @@ searchTermContainer.prototype = {
var searchAttribute=this.searchattribute;
var searchOperator=this.searchoperator;
var searchValue=this.searchvalue;
// now reflect all attributes of the searchterm into the widgets
if (searchAttribute)
{
// for custom, the value is the custom id, not the integer attribute
- if (term.attrib == Components.interfaces.nsMsgSearchAttrib.Custom)
+ if (term.attrib == Ci.nsMsgSearchAttrib.Custom)
searchAttribute.value = term.customId;
else
searchAttribute.value = term.attrib;
}
if (searchOperator) searchOperator.value = val.op;
if (searchValue) searchValue.value = term.value;
this.booleanAnd = val.booleanAnd;
@@ -98,17 +98,17 @@ searchTermContainer.prototype = {
get booleanAnd() { return this.internalBooleanAnd; },
set booleanAnd(val) {
this.internalBooleanAnd = val;
return val;
},
save: function () {
var searchTerm = this.searchTerm;
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
+ var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
if (isNaN(this.searchattribute.value)) // is this a custom term?
{
searchTerm.attrib = nsMsgSearchAttrib.Custom;
searchTerm.customId = this.searchattribute.value;
}
else
{
@@ -128,17 +128,17 @@ searchTermContainer.prototype = {
},
// if you have a search term element with no search term
saveTo: function(searchTerm) {
this.internalSearchTerm = searchTerm;
this.save();
}
}
-var nsIMsgSearchTerm = Components.interfaces.nsIMsgSearchTerm;
+var nsIMsgSearchTerm = Ci.nsIMsgSearchTerm;
function initializeSearchWidgets()
{
gSearchBooleanRadiogroup = document.getElementById("booleanAndGroup");
gSearchTermList = document.getElementById("searchTermList");
// initialize some strings
var bundle = document.getElementById('bundle_search');
--- a/mailnews/base/search/content/searchWidgets.xml
+++ b/mailnews/base/search/content/searchWidgets.xml
@@ -99,21 +99,21 @@
// walk through the list of filter actions and hide any actions which aren't valid
// for our given scope (news, imap, pop, etc) and context
let elements, i;
// disable / enable all elements in the "filteractionlist"
// based on the scope and the "enablefornews" attribute
elements = menupopup.getElementsByAttribute("enablefornews", "true");
for (i = 0; i < elements.length; i++)
- elements[i].hidden = scope != Components.interfaces.nsMsgSearchScope.newsFilter;
+ elements[i].hidden = scope != Ci.nsMsgSearchScope.newsFilter;
elements = menupopup.getElementsByAttribute("enablefornews", "false");
for (i = 0; i < elements.length; i++)
- elements[i].hidden = scope == Components.interfaces.nsMsgSearchScope.newsFilter;
+ elements[i].hidden = scope == Ci.nsMsgSearchScope.newsFilter;
elements = menupopup.getElementsByAttribute("enableforpop3", "true");
for (i = 0; i < elements.length; i++)
elements[i].hidden = !((gFilterList.folder.server.type == "pop3") ||
(gFilterList.folder.server.type == "none"));
elements = menupopup.getElementsByAttribute("isCustom", "true");
// Note there might be an additional element here as a placeholder
@@ -219,48 +219,48 @@
<parameter name="populateTemplateList"/>
<parameter name="templateMenuList"/>
<body>
<![CDATA[
ChromeUtils.import("resource:///modules/iteratorUtils.jsm", this);
let identitiesRaw = MailServices.accounts
.getIdentitiesForServer(gFilterList.folder.server);
let identities = Array.from(this.fixIterator(identitiesRaw,
- Components.interfaces.nsIMsgIdentity));
+ Ci.nsIMsgIdentity));
if (!identities.length) // typically if this is Local Folders
identities.push(MailServices.accounts.defaultAccount.defaultIdentity);
let templateFound = false;
let foldersScanned = [];
for (let identity of identities) {
let enumerator = null;
let msgFolder;
try {
- msgFolder = Components.classes["@mozilla.org/rdf/rdf-service;1"]
- .getService(Components.interfaces.nsIRDFService)
- .GetResource(identity.stationeryFolder)
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ msgFolder = Cc["@mozilla.org/rdf/rdf-service;1"]
+ .getService(Ci.nsIRDFService)
+ .GetResource(identity.stationeryFolder)
+ .QueryInterface(Ci.nsIMsgFolder);
// If we already processed this folder, do not set enumerator
// so that we skip this identity.
if (foldersScanned.indexOf(msgFolder) == -1) {
foldersScanned.push(msgFolder);
enumerator = msgFolder.msgDatabase.EnumerateMessages();
}
} catch (e) {
// The Templates folder may not exist, that is OK.
}
if (!enumerator)
continue;
while (enumerator.hasMoreElements()) {
let header = enumerator.getNext();
- if (header instanceof Components.interfaces.nsIMsgDBHdr) {
+ if (header instanceof Ci.nsIMsgDBHdr) {
templateFound = true;
if (!populateTemplateList)
return true;
let msgTemplateUri = msgFolder.URI + "?messageId=" +
header.messageId + '&subject=' + header.mime2DecodedSubject;
let newItem = templateMenuList.appendItem(header.mime2DecodedSubject,
msgTemplateUri);
}
@@ -354,17 +354,17 @@
<method name="initWithAction">
<parameter name="aFilterAction"/>
<body>
<![CDATA[
var filterActionStr;
var actionTarget = document.getAnonymousNodes(this)[1];
var actionItem = document.getAnonymousNodes(actionTarget);
- var nsMsgFilterAction = Components.interfaces.nsMsgFilterAction;
+ var nsMsgFilterAction = Ci.nsMsgFilterAction;
switch (aFilterAction.type)
{
case nsMsgFilterAction.Custom:
filterActionStr = aFilterAction.customId;
if (actionItem)
actionItem[0].value = aFilterAction.strValue;
// Make sure the custom action has been added. If not, it
@@ -384,21 +384,21 @@
var menuitem = document.createElementNS(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"xul:menuitem");
menuitem.setAttribute("label",
gFilterBundle.getString("filterMissingCustomAction"));
menuitem.setAttribute("value", filterActionStr);
menuitem.disabled = true;
this.mRuleActionType.menulist.menupopup.appendChild(menuitem);
- var scriptError = Components.classes["@mozilla.org/scripterror;1"]
- .createInstance(Components.interfaces.nsIScriptError);
+ var scriptError = Cc["@mozilla.org/scripterror;1"]
+ .createInstance(Ci.nsIScriptError);
scriptError.init("Missing custom action " + filterActionStr,
null, null, 0, 0,
- Components.interfaces.nsIScriptError.errorFlag,
+ Ci.nsIScriptError.errorFlag,
"component javascript");
Services.console.logMessage(scriptError);
}
break;
case nsMsgFilterAction.MoveToFolder:
case nsMsgFilterAction.CopyToFolder:
actionItem[0].value = aFilterAction.targetFolderUri;
break;
@@ -493,17 +493,17 @@
<body>
<![CDATA[
// create a new filter action, fill it in, and then append it to the filter
var filterAction = aFilter.createAction();
var filterActionString = this.getAttribute('value');
filterAction.type = gFilterActionStrings.indexOf(filterActionString);
var actionTarget = document.getAnonymousNodes(this)[1];
var actionItem = document.getAnonymousNodes(actionTarget);
- var nsMsgFilterAction = Components.interfaces.nsMsgFilterAction;
+ var nsMsgFilterAction = Ci.nsMsgFilterAction;
switch (filterAction.type)
{
case nsMsgFilterAction.Label:
filterAction.label = actionItem[0].getAttribute("value");
break;
case nsMsgFilterAction.ChangePriority:
filterAction.priority = actionItem[0].getAttribute("value");
break;
--- a/mailnews/base/search/src/nsMsgTraitService.js
+++ b/mailnews/base/search/src/nsMsgTraitService.js
@@ -26,17 +26,17 @@ function _registerTrait(aId, aIndex)
function nsMsgTraitService() {}
nsMsgTraitService.prototype =
{
// Component setup
classID: Components.ID("{A2E95F4F-DA72-4a41-9493-661AD353C00A}"),
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsIMsgTraitService]),
+ Ci.nsIMsgTraitService]),
// nsIMsgTraitService implementation
get lastIndex()
{
return _lastIndex;
},
--- a/mailnews/base/src/msgAsyncPrompter.js
+++ b/mailnews/base/src/msgAsyncPrompter.js
@@ -20,31 +20,31 @@ runnablePrompter.prototype = {
yield Services.logins.initializationPromise;
this._asyncPrompter._log.debug("Running prompt for " + this._hashKey);
let prompter = this._asyncPrompter._pendingPrompts[this._hashKey];
let ok = false;
try {
ok = prompter.first.onPromptStart();
}
catch (ex) {
- Components.utils.reportError("runnablePrompter:run: " + ex + "\n");
+ Cu.reportError("runnablePrompter:run: " + ex + "\n");
}
delete this._asyncPrompter._pendingPrompts[this._hashKey];
for (var consumer of prompter.consumers) {
try {
if (ok)
consumer.onPromptAuthAvailable();
else
consumer.onPromptCanceled();
}
catch (ex) {
// Log the error for extension devs and others to pick up.
- Components.utils.reportError("runnablePrompter:run: consumer.onPrompt* reported an exception: " + ex + "\n");
+ Cu.reportError("runnablePrompter:run: consumer.onPrompt* reported an exception: " + ex + "\n");
}
}
this._asyncPrompter._asyncPromptInProgress--;
this._asyncPrompter._log.debug("Finished running prompter for " + this._hashKey);
this._asyncPrompter._doAsyncAuthPrompt();
})
};
--- a/mailnews/base/src/nsMailNewsCommandLineHandler.js
+++ b/mailnews/base/src/nsMailNewsCommandLineHandler.js
@@ -152,15 +152,15 @@ var nsMailNewsCommandLineHandler =
};
function mailNewsCommandLineHandlerModule() {}
mailNewsCommandLineHandlerModule.prototype =
{
// XPCOM registration
classID: CMDLINEHANDLER_CID,
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIModule]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIModule]),
_xpcom_factory: nsMailNewsCommandLineHandler
};
var components = [mailNewsCommandLineHandlerModule];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/mailnews/base/test/unit/test_accountMigration.js
+++ b/mailnews/base/test/unit/test_accountMigration.js
@@ -44,24 +44,24 @@ function run_test() {
Assert.equal(Services.perms.testPermission(uriAllowed, "image"),
Services.perms.UNKNOWN_ACTION);
Assert.equal(Services.perms.testPermission(uriAllowed2, "image"),
Services.perms.UNKNOWN_ACTION);
Assert.equal(Services.perms.testPermission(uriDisallowed, "image"),
Services.perms.UNKNOWN_ACTION);
// Set default charsets to an encoding no longer supported: VISCII.
- let charset = Components.classes["@mozilla.org/pref-localizedstring;1"]
- .createInstance(Components.interfaces.nsIPrefLocalizedString);
+ let charset = Cc["@mozilla.org/pref-localizedstring;1"]
+ .createInstance(Ci.nsIPrefLocalizedString);
charset.data = "VISCII";
Services.prefs.setComplexValue("mailnews.send_default_charset",
- Components.interfaces.nsIPrefLocalizedString, charset);
+ Ci.nsIPrefLocalizedString, charset);
Assert.ok(Services.prefs.prefHasUserValue("mailnews.send_default_charset"));
Services.prefs.setComplexValue("mailnews.view_default_charset",
- Components.interfaces.nsIPrefLocalizedString, charset);
+ Ci.nsIPrefLocalizedString, charset);
Assert.ok(Services.prefs.prefHasUserValue("mailnews.view_default_charset"));
// Now migrate the prefs.
migrateMailnews();
// Check what has been set.
Assert.ok(!Services.prefs.prefHasUserValue("mail.server.server1.authMethod"));
Assert.ok(Services.prefs.prefHasUserValue("mail.server.server2.authMethod"));
--- a/mailnews/base/test/unit/test_compactColumnSave.js
+++ b/mailnews/base/test/unit/test_compactColumnSave.js
@@ -39,17 +39,17 @@ var gMsgHdrs = new Array();
var PERSISTED_COLUMN_PROPERTY_NAME = "columnStates";
var columnJSON = '{"threadCol":{"visible":true,"ordinal":"1"},"flaggedCol":{"visible":true,"ordinal":"4"},"attachmentCol":{"visible":true,"ordinal":"5"},"subjectCol":{"visible":true,"ordinal":"7"},"unreadButtonColHeader":{"visible":true,"ordinal":"9"},"senderCol":{"visible":true,"ordinal":"11"},"recipientCol":{"visible":false,"ordinal":"13"},"junkStatusCol":{"visible":true,"ordinal":"15"},"receivedCol":{"visible":true,"ordinal":"17"},"dateCol":{"visible":true,"ordinal":"19"},"statusCol":{"visible":false,"ordinal":"21"},"sizeCol":{"visible":true,"ordinal":"23"},"tagsCol":{"visible":false,"ordinal":"25"},"accountCol":{"visible":false,"ordinal":"27"},"priorityCol":{"visible":false,"ordinal":"29"},"unreadCol":{"visible":false,"ordinal":"31"},"totalCol":{"visible":false,"ordinal":"33"},"locationCol":{"visible":false,"ordinal":"35"},"idCol":{"visible":false,"ordinal":"37"}}';
function setColumnStates(folder) {
let msgDatabase = folder.msgDatabase;
let dbFolderInfo = msgDatabase.dBFolderInfo;
dbFolderInfo.setCharProperty(this.PERSISTED_COLUMN_PROPERTY_NAME, columnJSON);
- msgDatabase.Commit(Components.interfaces.nsMsgDBCommitType.kLargeCommit);
+ msgDatabase.Commit(Ci.nsMsgDBCommitType.kLargeCommit);
}
function checkPersistentState(folder) {
let msgDatabase = folder.msgDatabase;
let dbFolderInfo = msgDatabase.dBFolderInfo;
let state = dbFolderInfo.getCharProperty(this.PERSISTED_COLUMN_PROPERTY_NAME);
Assert.equal(state, columnJSON);
do_timeout(0, function(){doTest(++gCurTestNum);});
--- a/mailnews/base/test/unit/test_copyChaining.js
+++ b/mailnews/base/test/unit/test_copyChaining.js
@@ -33,17 +33,17 @@ var gTestArray =
CopyNextMessage();
},
];
function CopyNextMessage()
{
if (gMsgEnumerator.hasMoreElements()) {
let msgHdr = gMsgEnumerator.getNext().QueryInterface(
- Components.interfaces.nsIMsgDBHdr);
+ Ci.nsIMsgDBHdr);
var messages = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
messages.appendElement(msgHdr);
MailServices.copy.CopyMessages(gCopySource, messages, gCopyDest, true,
copyListener, null, false);
}
else
do_throw ('TEST FAILED - out of messages');
}
--- a/mailnews/base/test/unit/test_folderCompact.js
+++ b/mailnews/base/test/unit/test_folderCompact.js
@@ -112,33 +112,33 @@ function calculateFolderSize(folder)
let msgDB = folder.msgDatabase;
let enumerator = msgDB.EnumerateMessages();
let totalSize = 0;
if (enumerator)
{
while (enumerator.hasMoreElements())
{
var header = enumerator.getNext();
- if (header instanceof Components.interfaces.nsIMsgDBHdr)
+ if (header instanceof Ci.nsIMsgDBHdr)
totalSize += header.messageSize;
}
}
return totalSize;
}
function verifyMsgOffsets(folder)
{
let msgDB = folder.msgDatabase;
let enumerator = msgDB.EnumerateMessages();
if (enumerator)
{
while (enumerator.hasMoreElements())
{
let header = enumerator.getNext();
- if (header instanceof Components.interfaces.nsIMsgDBHdr) {
+ if (header instanceof Ci.nsIMsgDBHdr) {
let storeToken = header.getStringProperty("storeToken");
Assert.equal(storeToken, header.messageOffset);
}
}
}
}
/*
--- a/mailnews/base/test/unit/test_folderLookupService.js
+++ b/mailnews/base/test/unit/test_folderLookupService.js
@@ -5,18 +5,18 @@
/**
* This tests that nsIFolderLookupService works acording to specification.
*/
ChromeUtils.import("resource:///modules/mailServices.js");
var kRootURI = "mailbox://nobody@Local%20Folders";
function run_test() {
- let fls = Components.classes["@mozilla.org/mail/folder-lookup;1"]
- .getService(Components.interfaces.nsIFolderLookupService);
+ let fls = Cc["@mozilla.org/mail/folder-lookup;1"]
+ .getService(Ci.nsIFolderLookupService);
// Make sure that the local mail account exists.
localAccountUtils.loadLocalMailAccount();
// There should exist an inbox.
Assert.equal(fls.getFolderForURL(kRootURI + "/Inbox"),
localAccountUtils.inboxFolder);
--- a/mailnews/base/test/unit/test_junkingWhenDisabled.js
+++ b/mailnews/base/test/unit/test_junkingWhenDisabled.js
@@ -65,34 +65,34 @@ var gCommandUpdater = {
{
},
summarizeSelection : function() {return false;}
};
var gDBView;
var gTreeView;
-var SortType = Components.interfaces.nsMsgViewSortType;
-var SortOrder = Components.interfaces.nsMsgViewSortOrder;
-var ViewFlags = Components.interfaces.nsMsgViewFlagsType;
+var SortType = Ci.nsMsgViewSortType;
+var SortOrder = Ci.nsMsgViewSortOrder;
+var ViewFlags = Ci.nsMsgViewFlagsType;
function setup_view(aViewType, aViewFlags) {
let dbviewContractId = "@mozilla.org/messenger/msgdbview;1?type=" + aViewType;
// always start out fully expanded
aViewFlags |= ViewFlags.kExpandAll;
- gDBView = Components.classes[dbviewContractId]
- .createInstance(Components.interfaces.nsIMsgDBView);
+ gDBView = Cc[dbviewContractId]
+ .createInstance(Ci.nsIMsgDBView);
gDBView.init(null, null, gCommandUpdater);
var outCount = {};
gDBView.open(gLocalInboxFolder, SortType.byDate, SortOrder.ascending, aViewFlags, outCount);
dump(" View Out Count: " + outCount.value + "\n");
- gTreeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ gTreeView = gDBView.QueryInterface(Ci.nsITreeView);
gTreeView.selection = gFakeSelection;
gFakeSelection.view = gTreeView;
}
var tests_for_all_views = [
// In the proposed fix for bug 487610, the first call to junk messages
// only creates the junk folder, it does not actually successfully move
// messages. So we junk messages twice so we can really see a move. But
--- a/mailnews/base/test/unit/test_nsIMsgFolder.js
+++ b/mailnews/base/test/unit/test_nsIMsgFolder.js
@@ -5,17 +5,17 @@
ChromeUtils.import("resource:///modules/mailServices.js");
function run_test() {
// Create a local mail account (we need this first)
MailServices.accounts.createLocalMailAccount();
// Get the account
- let account = MailServices.accounts.accounts.queryElementAt(0, Components.interfaces.nsIMsgAccount);
+ let account = MailServices.accounts.accounts.queryElementAt(0, Ci.nsIMsgAccount);
// Get the root folder
var root = account.incomingServer.rootFolder;
// Add a sub folder to ensure that we have some folders created
root.createSubfolder("folder1", null);
// Test - getChildNamed
--- a/mailnews/base/test/unit/test_nsMsgDBView.js
+++ b/mailnews/base/test/unit/test_nsMsgDBView.js
@@ -221,96 +221,96 @@ var authorFirstLetterCustomColumn = {
getRowProperties: function(row) { return ""; },
getImageSrc: function(row, col) {return null;},
getSortLongForRow: function(hdr) {return 0;}
};
var gDBView;
var gTreeView;
-var ViewType = Components.interfaces.nsMsgViewType;
-var SortType = Components.interfaces.nsMsgViewSortType;
-var SortOrder = Components.interfaces.nsMsgViewSortOrder;
-var ViewFlags = Components.interfaces.nsMsgViewFlagsType;
-var MsgFlags = Components.interfaces.nsMsgMessageFlags;
+var ViewType = Ci.nsMsgViewType;
+var SortType = Ci.nsMsgViewSortType;
+var SortOrder = Ci.nsMsgViewSortOrder;
+var ViewFlags = Ci.nsMsgViewFlagsType;
+var MsgFlags = Ci.nsMsgMessageFlags;
var MSG_VIEW_FLAG_DUMMY = 0x20000000;
var MSG_VIEW_FLAG_HASCHILDREN = 0x40000000;
var MSG_VIEW_FLAG_ISTHREAD = 0x8000000;
var gFakeSelection = new JSTreeSelection(null);
function setup_view(aViewType, aViewFlags, aTestFolder) {
let dbviewContractId = "@mozilla.org/messenger/msgdbview;1?type=" + aViewType;
if (aTestFolder == null)
aTestFolder = gTestFolder;
// always start out fully expanded
aViewFlags |= ViewFlags.kExpandAll;
- gDBView = Components.classes[dbviewContractId]
- .createInstance(Components.interfaces.nsIMsgDBView);
+ gDBView = Cc[dbviewContractId]
+ .createInstance(Ci.nsIMsgDBView);
gDBView.init(null, null, gCommandUpdater);
var outCount = {};
gDBView.open(aViewType != "search" ? aTestFolder : null,
SortType.byDate,
aViewType != "search" ? SortOrder.ascending : SortOrder.descending,
aViewFlags, outCount);
// outCount is 0 if byCustom; view is built by addColumnHandler()
dump(" View Out Count: " + outCount.value + "\n");
// we need to cram messages into the search via nsIMsgSearchNotify interface
if (aViewType == "search" || aViewType == "quicksearch" || aViewType == "xfvf") {
let searchNotify = gDBView.QueryInterface(
- Components.interfaces.nsIMsgSearchNotify);
+ Ci.nsIMsgSearchNotify);
searchNotify.onNewSearch();
let enumerator = aTestFolder.msgDatabase.EnumerateMessages();
while (enumerator.hasMoreElements()) {
let msgHdr = enumerator.getNext().QueryInterface(
- Components.interfaces.nsIMsgDBHdr);
+ Ci.nsIMsgDBHdr);
searchNotify.onSearchHit(msgHdr, msgHdr.folder);
}
- searchNotify.onSearchDone(Components.results.NS_OK);
+ searchNotify.onSearchDone(Cr.NS_OK);
}
gDBView.addColumnHandler("authorFirstLetterCol",
authorFirstLetterCustomColumn);
// XXX this sets the custom column to use for sorting by the custom column.
// It has been argued (and is generally accepted) that this should not be
// so limited.
gDBView.curCustomColumn = "authorFirstLetterCol";
- gTreeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ gTreeView = gDBView.QueryInterface(Ci.nsITreeView);
gTreeView.selection = gFakeSelection;
gFakeSelection.view = gTreeView;
}
function setup_group_view(aSortType, aSortOrder, aTestFolder) {
let dbviewContractId = "@mozilla.org/messenger/msgdbview;1?type=group";
if (aTestFolder == null)
aTestFolder = gTestFolder;
// grouped view uses these flags
let viewFlags = ViewFlags.kGroupBySort |
ViewFlags.kExpandAll |
ViewFlags.kThreadedDisplay;
- gDBView = Components.classes[dbviewContractId]
- .createInstance(Components.interfaces.nsIMsgDBView);
+ gDBView = Cc[dbviewContractId]
+ .createInstance(Ci.nsIMsgDBView);
gDBView.init(null, null, gCommandUpdater);
var outCount = {};
gDBView.open(aTestFolder, aSortType, aSortOrder, viewFlags, outCount);
gDBView.addColumnHandler("authorFirstLetterCol",
authorFirstLetterCustomColumn);
gDBView.curCustomColumn = "authorFirstLetterCol";
- gTreeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ gTreeView = gDBView.QueryInterface(Ci.nsITreeView);
gFakeSelection.view = gTreeView;
gTreeView.selection = gFakeSelection;
}
/**
* Comparison func for built-in types (including strings, so no subtraction.)
*/
function generalCmp(a, b) {
@@ -598,17 +598,17 @@ function test_insert_remove_view_rows()
function test_msg_added_to_search_view() {
// if the view is a non-grouped search view, test adding a header to
// the search results, and verify it gets put at top.
if (! (gDBView.viewFlags & ViewFlags.kGroupBySort)) {
gDBView.sort(SortType.byDate, SortOrder.descending);
let [synMsg, synSet] = make_and_add_message();
let msgHdr = gTestFolder.msgDatabase.getMsgHdrForMessageID(synMsg.messageId);
- gDBView.QueryInterface(Components.interfaces.nsIMsgSearchNotify)
+ gDBView.QueryInterface(Ci.nsIMsgSearchNotify)
.onSearchHit(msgHdr, msgHdr.folder);
assert_view_message_at_indices(synMsg, 0);
}
}
function IsHdrChildOf(possibleParent, possibleChild) {
let parentHdrId = possibleParent.messageId;
let numRefs = possibleChild.numReferences;
--- a/mailnews/base/test/unit/test_nsMsgDBView_headerValues.js
+++ b/mailnews/base/test/unit/test_nsMsgDBView_headerValues.js
@@ -3,19 +3,19 @@
load("../../../resources/logHelper.js");
load("../../../resources/asyncTestUtils.js");
load("../../../resources/abSetup.js");
load("../../../resources/messageGenerator.js");
load("../../../resources/messageModifier.js");
load("../../../resources/messageInjection.js");
-var ViewType = Components.interfaces.nsMsgViewType;
-var SortType = Components.interfaces.nsMsgViewSortType;
-var SortOrder = Components.interfaces.nsMsgViewSortOrder;
+var ViewType = Ci.nsMsgViewType;
+var SortType = Ci.nsMsgViewSortType;
+var SortOrder = Ci.nsMsgViewSortOrder;
// This is an array of the actual test data. Each test datum is an array of two
// elements: the first element is the argument into a simple message generator,
// and the second element is a map of column names to expected values when
// requesting the cell text for a given column name.
var tests = [
[{from: "John Doe <db@tinderbox.invalid>"}, {sender: "John Doe"}],
[{from: "\"Doe, John\" <db@tinderbox.invalid>"}, {sender: "Doe, John"}],
@@ -40,24 +40,24 @@ function* real_test() {
// Add the messages to the folder
let msgGenerator = new MessageGenerator();
let genMessages = tests.map(data => msgGenerator.makeMessage(data[0]));
let folder = make_empty_folder();
yield add_sets_to_folder(folder, [new SyntheticMessageSet(genMessages)]);
// Make the DB view
let dbviewContractId = "@mozilla.org/messenger/msgdbview;1?type=threaded";
- let dbView = Components.classes[dbviewContractId]
- .createInstance(Components.interfaces.nsIMsgDBView);
+ let dbView = Cc[dbviewContractId]
+ .createInstance(Ci.nsIMsgDBView);
dbView.init(null, null, null);
var outCount = {};
dbView.open(folder, SortType.byDate, SortOrder.ascending, 0, outCount);
// Did we add all the messages properly?
- let treeView = dbView.QueryInterface(Components.interfaces.nsITreeView);
+ let treeView = dbView.QueryInterface(Ci.nsITreeView);
Assert.equal(treeView.rowCount, tests.length);
// For each test, make sure that the display is correct.
tests.forEach(function (data, i) {
info("Checking data for " + uneval(data));
let expected = data[1];
for (let column in expected) {
Assert.equal(dbView.cellTextForColumn(i, column), expected[column]);
--- a/mailnews/base/test/unit/test_nsMsgMailSession_Listeners.js
+++ b/mailnews/base/test/unit/test_nsMsgMailSession_Listeners.js
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Test suite for nsMsgMailSession functions relating to listeners.
*/
ChromeUtils.import("resource:///modules/mailServices.js");
-var nsIFolderListener = Components.interfaces.nsIFolderListener;
+var nsIFolderListener = Ci.nsIFolderListener;
var numListenerFunctions = 8;
var gMailSessionNotifier = MailServices.mailSession.QueryInterface(nsIFolderListener);
var gFLAll;
var gFLSingle = new Array(numListenerFunctions);
function fL() {}
--- a/mailnews/base/test/unit/test_retention.js
+++ b/mailnews/base/test/unit/test_retention.js
@@ -38,18 +38,18 @@ function* actually_run_test() {
yield async_run({func: setup_globals});
let numMessages = 10;
gTestFolder.msgDatabase = null;
gTestFolder.applyRetentionSettings();
const gDbService = Cc["@mozilla.org/msgDatabase/msgDBService;1"]
.getService(Ci.nsIMsgDBService);
// adding messages leaves some headers around as garbage - make sure
// those are cleaned up so the db will get closed.
- Components.utils.forceGC();
- Components.utils.forceCC();
+ Cu.forceGC();
+ Cu.forceCC();
Assert.equal(gDbService.cachedDBForFolder(gTestFolder), null);
// no retention settings, so we should have the same number of messages.
Assert.equal(numMessages, gTestFolder.msgDatabase.dBFolderInfo.numMessages);
let serverSettings = gTestFolder.server.retentionSettings;
serverSettings.retainByPreference = Ci.nsIMsgRetentionSettings.nsMsgRetainByNumHeaders;
serverSettings.numHeadersToKeep = 9;
gTestFolder.server.retentionSettings = serverSettings;
gTestFolder.applyRetentionSettings();
--- a/mailnews/base/test/unit/test_viewSortByAddresses.js
+++ b/mailnews/base/test/unit/test_viewSortByAddresses.js
@@ -131,35 +131,35 @@ function dump_view_contents() {
function view_throw(why) {
dump_view_contents();
do_throw(why);
}
var gDBView;
var gTreeView;
-var ViewType = Components.interfaces.nsMsgViewType;
-var SortType = Components.interfaces.nsMsgViewSortType;
-var SortOrder = Components.interfaces.nsMsgViewSortOrder;
-var ViewFlags = Components.interfaces.nsMsgViewFlagsType;
+var ViewType = Ci.nsMsgViewType;
+var SortType = Ci.nsMsgViewSortType;
+var SortOrder = Ci.nsMsgViewSortOrder;
+var ViewFlags = Ci.nsMsgViewFlagsType;
function setup_view(aViewType, aViewFlags, aTestFolder) {
let dbviewContractId = "@mozilla.org/messenger/msgdbview;1?type=" + aViewType;
if (aTestFolder == null)
aTestFolder = gTestFolder;
// always start out fully expanded
aViewFlags |= ViewFlags.kExpandAll;
- gDBView = Components.classes[dbviewContractId]
- .createInstance(Components.interfaces.nsIMsgDBView);
+ gDBView = Cc[dbviewContractId]
+ .createInstance(Ci.nsIMsgDBView);
gDBView.init(null, null, gCommandUpdater);
var outCount = {};
gDBView.open(aViewType != "search" ? aTestFolder : null,
SortType.byDate,
aViewType != "search" ? SortOrder.ascending : SortOrder.descending,
aViewFlags, outCount);
dump(" View Out Count: " + outCount.value + "\n");
- gTreeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ gTreeView = gDBView.QueryInterface(Ci.nsITreeView);
}
--- a/mailnews/base/util/ABQueryUtils.jsm
+++ b/mailnews/base/util/ABQueryUtils.jsm
@@ -62,17 +62,17 @@ function getSearchTokens(aSearchString)
* If phonetic search is used, corresponding pref must exist:
* e.g. mail.addr_book.quicksearchquery.format.phonetic
* @return depending on mail.addr_book.show_phonetic_fields pref,
* the value of aBasePrefName or aBasePrefName + ".phonetic"
*/
function getModelQuery(aBasePrefName) {
let modelQuery = "";
if (Services.prefs.getComplexValue("mail.addr_book.show_phonetic_fields",
- Components.interfaces.nsIPrefLocalizedString).data == "true") {
+ Ci.nsIPrefLocalizedString).data == "true") {
modelQuery = Services.prefs.getCharPref(aBasePrefName + ".phonetic");
} else {
modelQuery = Services.prefs.getCharPref(aBasePrefName);
}
// remove leading "?" to migrate existing customized values for mail.addr_book.quicksearchquery.format
// todo: could this be done in a once-off migration at install time to avoid repetitive calls?
if (modelQuery.startsWith("?"))
modelQuery = modelQuery.slice(1);
@@ -84,17 +84,17 @@ function getModelQuery(aBasePrefName) {
* @param aBasePrefName the full pref name of default, non-phonetic model query,
* e.g. mail.addr_book.quicksearchquery.format
* If phonetic search is used, corresponding pref must exist:
* e.g. mail.addr_book.quicksearchquery.format.phonetic
* @return true or false
*/
function modelQueryHasUserValue(aBasePrefName) {
if (Services.prefs.getComplexValue("mail.addr_book.show_phonetic_fields",
- Components.interfaces.nsIPrefLocalizedString).data == "true")
+ Ci.nsIPrefLocalizedString).data == "true")
return Services.prefs.prefHasUserValue(aBasePrefName + ".phonetic");
return Services.prefs.prefHasUserValue(aBasePrefName);
}
/*
* Given a database model query and a list of search tokens,
* return query URI.
*
--- a/mailnews/base/util/IOUtils.js
+++ b/mailnews/base/util/IOUtils.js
@@ -106,21 +106,21 @@ var IOUtils =
// Write the input stream to the file.
// PR_WRITE + PR_CREATE + PR_TRUNCATE
fstream.init(aFile, 0x04 | 0x08 | 0x20, aPerms, 0);
buffer.init(fstream, kStreamBlockSize);
buffer.writeFrom(aIStream, aIStream.available());
// Close the output streams.
- if (buffer instanceof Components.interfaces.nsISafeOutputStream)
+ if (buffer instanceof Ci.nsISafeOutputStream)
buffer.finish();
else
buffer.close();
- if (fstream instanceof Components.interfaces.nsISafeOutputStream)
+ if (fstream instanceof Ci.nsISafeOutputStream)
fstream.finish();
else
fstream.close();
// Close the input stream.
aIStream.close();
return aFile;
},
--- a/mailnews/base/util/OAuth2.jsm
+++ b/mailnews/base/util/OAuth2.jsm
@@ -98,17 +98,17 @@ OAuth2.prototype = {
_active: true,
iconURI: "",
cancelled: function() {
if (!this._active) {
return;
}
this.account.finishAuthorizationRequest();
- this.account.onAuthorizationFailed(Components.results.NS_ERROR_ABORT, '{ "error": "cancelled"}');
+ this.account.onAuthorizationFailed(Cr.NS_ERROR_ABORT, '{ "error": "cancelled"}');
},
loaded: function (aWindow, aWebProgress) {
if (!this._active) {
return;
}
this._listener = {
--- a/mailnews/base/util/StringBundle.js
+++ b/mailnews/base/util/StringBundle.js
@@ -93,17 +93,17 @@ StringBundle.prototype = {
let enumerator = this.stringBundle.getSimpleEnumeration();
while (enumerator.hasMoreElements()) {
// We could simply return the nsIPropertyElement objects, but I think
// it's better to return standard JS objects that behave as consumers
// expect JS objects to behave (f.e. you can modify them dynamically).
let string = enumerator.getNext()
- .QueryInterface(Components.interfaces.nsIPropertyElement);
+ .QueryInterface(Ci.nsIPropertyElement);
strings.push({ key: string.key, value: string.value });
}
return strings;
},
// the deprecated XBL binding-compatible API
--- a/mailnews/base/util/errUtils.js
+++ b/mailnews/base/util/errUtils.js
@@ -26,18 +26,18 @@ function logObject(aObj, aName) {
* @param aException the exception to log
* @param [aRethrow] set to true to rethrow the exception after logging
* @param [aMsg] optional message to log
*/
function logException(aException, aRethrow, aMsg) {
stringifier.dumpException(aException, aMsg);
if (aMsg)
- Components.utils.reportError(aMsg);
- Components.utils.reportError(aException);
+ Cu.reportError(aMsg);
+ Cu.reportError(aException);
if (aRethrow)
throw aException;
}
/**
* Log an DOM element to stdout.
* @param aElement the DOM element to dump
--- a/mailnews/base/util/folderUtils.jsm
+++ b/mailnews/base/util/folderUtils.jsm
@@ -14,17 +14,17 @@ ChromeUtils.import("resource:///modules/
ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
/**
* Returns a string representation of a folder's "special" type.
*
* @param aFolder the nsIMsgFolder whose special type should be returned
*/
function getSpecialFolderString(aFolder) {
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
let flags = aFolder.flags;
if (flags & nsMsgFolderFlags.Inbox)
return "Inbox";
if (flags & nsMsgFolderFlags.Trash)
return "Trash";
if (flags & nsMsgFolderFlags.Queue)
return "Outbox";
if (flags & nsMsgFolderFlags.SentMail)
@@ -48,17 +48,17 @@ function getSpecialFolderString(aFolder)
*
* @param nsIMsgFolder aFolder the folder whose properties should be returned
* as a string
* @param bool aOpen true if the folder is open/expanded
*
* @return A string of the property names, delimited by space.
*/
function getFolderProperties(aFolder, aOpen) {
- const nsIMsgFolder = Components.interfaces.nsIMsgFolder;
+ const nsIMsgFolder = Ci.nsIMsgFolder;
let properties = [];
properties.push("folderNameCol");
properties.push("serverType-" + aFolder.server.type);
// set the SpecialFolder attribute
properties.push("specialFolder-" + getSpecialFolderString(aFolder));
@@ -147,17 +147,17 @@ function compareAccounts(aAccount1, aAcc
/**
* Returns a list of accounts sorted by server type.
*
* @param aExcludeIMAccounts Remove IM accounts from the list?
*/
function allAccountsSorted(aExcludeIMAccounts) {
// Get the account list, and add the proper items.
let accountList = toArray(fixIterator(MailServices.accounts.accounts,
- Components.interfaces.nsIMsgAccount));
+ Ci.nsIMsgAccount));
// This is a HACK to work around bug 41133. If we have one of the
// dummy "news" accounts there, that account won't have an
// incomingServer attached to it, and everything will blow up.
accountList = accountList.filter(function hasServer(a) {
return a.incomingServer;
});
--- a/mailnews/base/util/iteratorUtils.jsm
+++ b/mailnews/base/util/iteratorUtils.jsm
@@ -107,18 +107,18 @@ function fixIterator(aEnum, aIface) {
* @param aInterface the type of XPCOM array to convert
*
* @note The returned array is *not* dynamically updated. Changes made to the
* JS array after a call to this function will not be reflected in the
* XPCOM array.
*/
function toXPCOMArray(aArray, aInterface) {
if (aInterface.equals(Ci.nsIMutableArray)) {
- let mutableArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Ci.nsIMutableArray);
+ let mutableArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
for (let item of fixIterator(aArray)) {
mutableArray.appendElement(item);
}
return mutableArray;
}
// We got something unexpected, notify the caller loudly.
throw new Error("An unsupported interface requested from toXPCOMArray: " +
--- a/mailnews/base/util/mailnewsMigrator.js
+++ b/mailnews/base/util/mailnewsMigrator.js
@@ -131,28 +131,28 @@ function MigrateABRemoteContentSettings(
{
let migrateAddress = function(aEmail) {
let uri = Services.io.newURI(
"chrome://messenger/content/email=" + aEmail);
Services.perms.add(uri, "image", Services.perms.ALLOW_ACTION);
}
let addrbook = enumerator.getNext()
- .QueryInterface(Components.interfaces.nsIAbDirectory);
+ .QueryInterface(Ci.nsIAbDirectory);
try {
// If it's a read-only book, don't try to find a card as we we could never
// have set the AllowRemoteContent property.
if (addrbook.readOnly)
continue;
let childCards = addrbook.childCards;
while (childCards.hasMoreElements())
{
let card = childCards.getNext()
- .QueryInterface(Components.interfaces.nsIAbCard);
+ .QueryInterface(Ci.nsIAbCard);
if (card.getProperty("AllowRemoteContent", false) == false)
continue; // not allowed for this contact
if (card.primaryEmail)
migrateAddress(card.primaryEmail);
if (card.getProperty("SecondEmail", ""))
@@ -169,32 +169,32 @@ function MigrateABRemoteContentSettings(
* If the default sending or viewing charset is one that is no longer available,
* change it back to the default.
*/
function MigrateDefaultCharsets()
{
if (Services.prefs.prefHasUserValue("mail.default_charsets.migrated"))
return;
- let charsetConvertManager = Components.classes['@mozilla.org/charset-converter-manager;1']
- .getService(Components.interfaces.nsICharsetConverterManager);
+ let charsetConvertManager = Cc['@mozilla.org/charset-converter-manager;1']
+ .getService(Ci.nsICharsetConverterManager);
let sendCharsetStr = Services.prefs.getComplexValue(
"mailnews.send_default_charset",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
try {
charsetConvertManager.getCharsetTitle(sendCharsetStr);
} catch (e) {
Services.prefs.clearUserPref("mailnews.send_default_charset");
}
let viewCharsetStr = Services.prefs.getComplexValue(
"mailnews.view_default_charset",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
try {
charsetConvertManager.getCharsetTitle(viewCharsetStr);
} catch (e) {
Services.prefs.clearUserPref("mailnews.view_default_charset");
}
Services.prefs.setIntPref("mail.default_charsets.migrated",
--- a/mailnews/compose/content/askSendFormat.js
+++ b/mailnews/compose/content/askSendFormat.js
@@ -7,18 +7,18 @@ var gParam = null;
/**
* This dialog should be opened with arguments like e.g.
* {action: nsIMsgCompSendFormat.AskUser, convertible: nsIMsgCompConvertible.Yes}
*/
function Startup()
{
gParam = window.arguments[0];
- const msgCompSendFormat = Components.interfaces.nsIMsgCompSendFormat;
- const msgCompConvertible = Components.interfaces.nsIMsgCompConvertible;
+ const msgCompSendFormat = Ci.nsIMsgCompSendFormat;
+ const msgCompConvertible = Ci.nsIMsgCompConvertible;
var bundle = document.getElementById("askSendFormatStringBundle");
// If the user hits the close box, we will abort.
gParam.abort = true;
// Set the question label
var mailSendFormatExplanation = document.getElementById("mailSendFormatExplanation");
--- a/mailnews/compose/content/mailComposeEditorOverlay.xul
+++ b/mailnews/compose/content/mailComposeEditorOverlay.xul
@@ -18,17 +18,17 @@
var gMsgCompPrevMozDoNotSendAttribute;
var gMsgCompAttachSourceElement = null;
function OnLoadOverlay()
{
gMsgCompAttachSourceElement = document.getElementById("AttachSourceToMail");
var editor = GetCurrentEditor();
if (gMsgCompAttachSourceElement && editor &&
- (editor.flags & Components.interfaces.nsIPlaintextEditor.eEditorMailMask))
+ (editor.flags & Ci.nsIPlaintextEditor.eEditorMailMask))
{
SetRelativeCheckbox = function() { SetAttachCheckbox();};
//initialize the AttachSourceToMail checkbox
gMsgCompAttachSourceElement.hidden = false;
switch (document.documentElement.id)
{
case "imageDlg":
@@ -114,25 +114,25 @@
function DoAttachSourceCheckbox()
{
gMsgCompPrevMozDoNotSendAttribute = (!gMsgCompAttachSourceElement.checked).toString();
globalElement.setAttribute("moz-do-not-send", gMsgCompPrevMozDoNotSendAttribute);
}
function GenerateDataURL(url) {
var file = Services.io.newURI(url)
- .QueryInterface(Components.interfaces.nsIFileURL).file;
- var contentType = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService)
+ .QueryInterface(Ci.nsIFileURL).file;
+ var contentType = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService)
.getTypeFromFile(file);
- var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"]
- .createInstance(Components.interfaces.nsIFileInputStream);
+ var inputStream = Cc["@mozilla.org/network/file-input-stream;1"]
+ .createInstance(Ci.nsIFileInputStream);
inputStream.init(file, 0x01, 0o600, 0);
- var stream = Components.classes["@mozilla.org/binaryinputstream;1"]
- .createInstance(Components.interfaces.nsIBinaryInputStream);
+ var stream = Cc["@mozilla.org/binaryinputstream;1"]
+ .createInstance(Ci.nsIBinaryInputStream);
stream.setInputStream(inputStream);
let data = "";
while (stream.available() > 0) {
data += stream.readBytes(stream.available());
}
let encoded = btoa(data);
stream.close();
return "data:" + contentType +
--- a/mailnews/compose/content/sendProgress.js
+++ b/mailnews/compose/content/sendProgress.js
@@ -1,36 +1,36 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-var nsIMsgCompDeliverMode = Components.interfaces.nsIMsgCompDeliverMode;
+var nsIMsgCompDeliverMode = Ci.nsIMsgCompDeliverMode;
// dialog is just an array we'll use to store various properties from the dialog document...
var dialog;
// the msgProgress is a nsIMsgProgress object
var msgProgress = null;
// random global variables...
var itsASaveOperation = false;
var gSendProgressStringBundle;
// all progress notifications are done through the nsIWebProgressListener implementation...
var progressListener = {
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus)
{
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_START)
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_START)
{
// Put progress meter in undetermined mode.
dialog.progress.setAttribute("mode", "undetermined");
}
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP)
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
{
// we are done sending/saving the message...
// Indicate completion in status area.
var msg;
if (itsASaveOperation)
msg = gSendProgressStringBundle.getString("messageSaved");
else
msg = gSendProgressStringBundle.getString("messageSent");
@@ -87,42 +87,42 @@ var progressListener = {
onSecurityChange: function(aWebProgress, aRequest, state)
{
// we can ignore this notification
},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIWebProgressListener) ||
- iid.equals(Components.interfaces.nsISupportsWeakReference) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIWebProgressListener) ||
+ iid.equals(Ci.nsISupportsWeakReference) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
};
function onLoad()
{
// Set global variables.
let subject = "";
gSendProgressStringBundle = document.getElementById("sendProgressStringBundle");
msgProgress = window.arguments[0];
if (!msgProgress)
{
- Components.utils.reportError("Invalid argument to sendProgress.xul.");
+ Cu.reportError("Invalid argument to sendProgress.xul.");
window.close();
return;
}
if (window.arguments[1])
{
- let progressParams = window.arguments[1].QueryInterface(Components.interfaces.nsIMsgComposeProgressParams);
+ let progressParams = window.arguments[1].QueryInterface(Ci.nsIMsgComposeProgressParams);
if (progressParams)
{
itsASaveOperation = (progressParams.deliveryMode != nsIMsgCompDeliverMode.Now);
subject = progressParams.subject;
}
}
if (subject) {
--- a/mailnews/compose/src/nsSMTPProtocolHandler.js
+++ b/mailnews/compose/src/nsSMTPProtocolHandler.js
@@ -1,61 +1,61 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var kNetworkProtocolCIDPrefix = "@mozilla.org/network/protocol;1?name=";
-var nsIProtocolHandler = Components.interfaces.nsIProtocolHandler;
+var nsIProtocolHandler = Ci.nsIProtocolHandler;
function makeProtocolHandler(aProtocol, aDefaultPort, aClassID) {
return {
classID: Components.ID(aClassID),
QueryInterface: XPCOMUtils.generateQI([nsIProtocolHandler]),
scheme: aProtocol,
defaultPort: aDefaultPort,
protocolFlags: nsIProtocolHandler.URI_NORELATIVE |
nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
nsIProtocolHandler.URI_NON_PERSISTABLE |
nsIProtocolHandler.ALLOWS_PROXY |
nsIProtocolHandler.URI_FORBIDS_AUTOMATIC_DOCUMENT_REPLACEMENT,
newURI: function (aSpec, aOriginCharset, aBaseURI) {
- var url = Components.classes["@mozilla.org/messengercompose/smtpurl;1"]
- .createInstance(Components.interfaces.nsIURI);
- if (url instanceof Components.interfaces.nsISmtpUrl)
+ var url = Cc["@mozilla.org/messengercompose/smtpurl;1"]
+ .createInstance(Ci.nsIURI);
+ if (url instanceof Ci.nsISmtpUrl)
url.init(aSpec);
return url;
},
newChannel: function (aURI) {
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
newChannel2: function(aURI, aLoadInfo)
{
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
allowPort: function (port, scheme) {
return port == aDefaultPort;
}
};
}
function nsSMTPProtocolHandler() {}
nsSMTPProtocolHandler.prototype =
makeProtocolHandler("smtp",
- Components.interfaces.nsISmtpUrl.DEFAULT_SMTP_PORT,
+ Ci.nsISmtpUrl.DEFAULT_SMTP_PORT,
"b14c2b67-8680-4c11-8d63-9403c7d4f757");
function nsSMTPSProtocolHandler() {}
nsSMTPSProtocolHandler.prototype =
makeProtocolHandler("smtps",
- Components.interfaces.nsISmtpUrl.DEFAULT_SMTPS_PORT,
+ Ci.nsISmtpUrl.DEFAULT_SMTPS_PORT,
"057d0997-9e3a-411e-b4ee-2602f53fe05f");
var components = [nsSMTPProtocolHandler, nsSMTPSProtocolHandler];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/mailnews/compose/test/unit/head_compose.js
+++ b/mailnews/compose/test/unit/head_compose.js
@@ -93,17 +93,17 @@ var copyListener = {
// QueryInterface
QueryInterface: function (iid) {
if (iid.equals(Ci.nsIMsgSendListener) ||
iid.equals(Ci.nsIMsgCopyServiceListener) ||
iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
};
var progressListener = {
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
this.resolve(mailTestUtils.firstMsgHdr(gDraftFolder));
},
@@ -115,17 +115,17 @@ var progressListener = {
onSecurityChange: function(aWebProgress, aRequest, state) {},
QueryInterface : function(iid) {
if (iid.equals(Ci.nsIWebProgressListener) ||
iid.equals(Ci.nsISupportsWeakReference) ||
iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
};
function createMessage(aAttachment) {
let fields = Cc["@mozilla.org/messengercompose/composefields;1"]
.createInstance(Ci.nsIMsgCompFields);
let attachments = [];
if (aAttachment) {
--- a/mailnews/compose/test/unit/test_autoReply.js
+++ b/mailnews/compose/test/unit/test_autoReply.js
@@ -88,17 +88,17 @@ add_task(function* copy_gTemplateMailFil
/// Test that a reply is NOT sent when the message is not addressed to "me".
add_task(function testReplyingToUnaddressedFails() {
try {
testReply(0); // mail 0 is not to us!
do_throw("Replied to a message not addressed to us!");
}
catch (e) {
- if (e.result != Components.results.NS_ERROR_ABORT)
+ if (e.result != Cr.NS_ERROR_ABORT)
throw e;
// Ok! We didn't reply to the message not specifically addressed to
// us (from@foo.invalid).
}
});
/// Test that a reply is sent when the message is addressed to "me".
add_task(function testReplyingToAdressedWorksLatin1() {
@@ -123,17 +123,17 @@ add_task(function testReplyingToAdressed
/// Test that a reply is NOT even tried when the message has no From.
add_task(function testReplyingToMailWithNoFrom() {
try {
testReply(2); // mail 2 has no From
do_throw("Shouldn't even have tried to reply reply to the message " +
"with no From and no Reply-To");
}
catch (e) {
- if (e.result != Components.results.NS_ERROR_FAILURE)
+ if (e.result != Cr.NS_ERROR_FAILURE)
throw e;
}
});
/// Test reply with template.
function testReply(aHrdIdx, aTemplateHdrIdx = 0) {
let smtpServer = getBasicSmtpServer();
smtpServer.port = gServer.port;
--- a/mailnews/compose/test/unit/test_expandMailingLists.js
+++ b/mailnews/compose/test/unit/test_expandMailingLists.js
@@ -2,42 +2,42 @@
/**
* Tests nsMsgCompose expandMailingLists.
*/
var MsgComposeContractID = "@mozilla.org/messengercompose/compose;1";
var MsgComposeParamsContractID = "@mozilla.org/messengercompose/composeparams;1";
var MsgComposeFieldsContractID = "@mozilla.org/messengercompose/composefields;1";
-var nsIMsgCompose = Components.interfaces.nsIMsgCompose;
-var nsIMsgComposeParams = Components.interfaces.nsIMsgComposeParams;
-var nsIMsgCompFields = Components.interfaces.nsIMsgCompFields;
+var nsIMsgCompose = Ci.nsIMsgCompose;
+var nsIMsgComposeParams = Ci.nsIMsgComposeParams;
+var nsIMsgCompFields = Ci.nsIMsgCompFields;
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
/**
* Helper to check population worked as expected.
* @param aTo - text in the To field
* @param aCheckTo - the expected To addresses (after possible list population)
*/
function checkPopulate(aTo, aCheckTo)
{
- let msgCompose = Components.classes[MsgComposeContractID]
- .createInstance(nsIMsgCompose);
+ let msgCompose = Cc[MsgComposeContractID]
+ .createInstance(nsIMsgCompose);
// Set up some basic fields for compose.
- let fields = Components.classes[MsgComposeFieldsContractID]
- .createInstance(nsIMsgCompFields);
+ let fields = Cc[MsgComposeFieldsContractID]
+ .createInstance(nsIMsgCompFields);
fields.to = aTo;
// Set up some params
- let params = Components.classes[MsgComposeParamsContractID]
- .createInstance(nsIMsgComposeParams);
+ let params = Cc[MsgComposeParamsContractID]
+ .createInstance(nsIMsgComposeParams);
params.composeFields = fields;
msgCompose.initialize(params);
msgCompose.expandMailingLists();
equal(fields.to, aCheckTo);
}
--- a/mailnews/compose/test/unit/test_mailtoURL.js
+++ b/mailnews/compose/test/unit/test_mailtoURL.js
@@ -1,22 +1,22 @@
/*
* Test suite for mailto: URLs
*/
ChromeUtils.import("resource://gre/modules/Services.jsm");
-var nsIMailtoUrl = Components.interfaces.nsIMailtoUrl;
-var COMPOSE_HTML = Components.interfaces.nsIMsgCompFormat.HTML;
-var COMPOSE_DEFAULT = Components.interfaces.nsIMsgCompFormat.Default;
+var nsIMailtoUrl = Ci.nsIMailtoUrl;
+var COMPOSE_HTML = Ci.nsIMsgCompFormat.HTML;
+var COMPOSE_DEFAULT = Ci.nsIMsgCompFormat.Default;
function run_test() {
function test(aTest) {
var uri = Services.io.newURI(aTest.url);
- uri = uri.QueryInterface(Components.interfaces.nsIMailtoUrl);
+ uri = uri.QueryInterface(Ci.nsIMailtoUrl);
var to = {}, cc = {}, bcc = {}, subject = {}, body = {}, html = {},
reference = {}, newsgroup = {}, composeformat = {};
uri.getMessageContents(to, cc, bcc, subject, body, html, reference,
newsgroup, composeformat);
Assert.equal(aTest.to, to.value);
Assert.equal(aTest.cc, cc.value);
Assert.equal(aTest.bcc, bcc.value);
@@ -35,17 +35,17 @@ function run_test() {
Assert.ok(uri.equals(uri));
}
for (var i = 0; i < tests.length; i++)
test(tests[i]);
// Test cloning reparses the url by checking the to field.
let uriToClone = Services.io.newURI(tests[0].url);
- let clonedUrl = uriToClone.clone().QueryInterface(Components.interfaces.nsIMailtoUrl);
+ let clonedUrl = uriToClone.clone().QueryInterface(Ci.nsIMailtoUrl);
var to = {}, cc = {}, bcc = {}, subject = {}, body = {}, html = {},
reference = {}, newsgroup = {}, composeformat = {};
clonedUrl.getMessageContents(to, cc, bcc, subject, body, html, reference,
newsgroup, composeformat);
Assert.equal(to.value, tests[0].to);
};
var tests = [
--- a/mailnews/compose/test/unit/test_messageHeaders.js
+++ b/mailnews/compose/test/unit/test_messageHeaders.js
@@ -189,17 +189,17 @@ function* testDraftInfo() {
fields.attachmentReminder = true;
yield richCreateMessage(fields, [], identity);
checkDraftHeaders({
"X-Mozilla-Draft-Info": "internal/draft; " +
"vcard=1; receipt=1; DSN=1; uuencode=0; attachmentreminder=1; deliveryformat=4",
});
- fields.deliveryFormat = Components.interfaces.nsIMsgCompSendFormat.Both;
+ fields.deliveryFormat = Ci.nsIMsgCompSendFormat.Both;
yield richCreateMessage(fields, [], identity);
checkDraftHeaders({
"X-Mozilla-Draft-Info": "internal/draft; " +
"vcard=1; receipt=1; DSN=1; uuencode=0; attachmentreminder=1; deliveryformat=3",
});
}
function* testOtherHeaders() {
--- a/mailnews/compose/test/unit/test_nsMsgCompose1.js
+++ b/mailnews/compose/test/unit/test_nsMsgCompose1.js
@@ -2,41 +2,41 @@
/**
* Tests nsMsgCompose expandMailingLists.
*/
var MsgComposeContractID = "@mozilla.org/messengercompose/compose;1";
var MsgComposeParamsContractID = "@mozilla.org/messengercompose/composeparams;1";
var MsgComposeFieldsContractID = "@mozilla.org/messengercompose/composefields;1";
-var nsIMsgCompose = Components.interfaces.nsIMsgCompose;
-var nsIMsgComposeParams = Components.interfaces.nsIMsgComposeParams;
-var nsIMsgCompFields = Components.interfaces.nsIMsgCompFields;
+var nsIMsgCompose = Ci.nsIMsgCompose;
+var nsIMsgComposeParams = Ci.nsIMsgComposeParams;
+var nsIMsgCompFields = Ci.nsIMsgCompFields;
ChromeUtils.import("resource://gre/modules/Services.jsm");
/**
* Helper to check population worked as expected.
* @param aTo - text in the To field
* @param aCheckTo - the expected To addresses (after possible ist population)
*/
function checkPopulate(aTo, aCheckTo)
{
- var msgCompose = Components.classes[MsgComposeContractID]
- .createInstance(nsIMsgCompose);
+ var msgCompose = Cc[MsgComposeContractID]
+ .createInstance(nsIMsgCompose);
// Set up some basic fields for compose.
- var fields = Components.classes[MsgComposeFieldsContractID]
- .createInstance(nsIMsgCompFields);
+ var fields = Cc[MsgComposeFieldsContractID]
+ .createInstance(nsIMsgCompFields);
fields.to = aTo;
// Set up some params
- var params = Components.classes[MsgComposeParamsContractID]
- .createInstance(nsIMsgComposeParams);
+ var params = Cc[MsgComposeParamsContractID]
+ .createInstance(nsIMsgComposeParams);
params.composeFields = fields;
msgCompose.initialize(params);
msgCompose.expandMailingLists();
let addresses = fields.getHeader("To");
let checkEmails = MailServices.headerParser.parseDecodedHeader(aCheckTo);
@@ -57,44 +57,44 @@ function run_test() {
testAB = do_get_file("../../../data/abLists2.mab");
// Copy the file to the profile directory for a CAB
testAB.copyTo(do_get_profile(), kCABData.fileName);
// Test - Check we can initalize with fewest specified
// parameters and don't fail/crash like we did in bug 411646.
- var msgCompose = Components.classes[MsgComposeContractID]
- .createInstance(nsIMsgCompose);
+ var msgCompose = Cc[MsgComposeContractID]
+ .createInstance(nsIMsgCompose);
// Set up some params
- var params = Components.classes[MsgComposeParamsContractID]
- .createInstance(nsIMsgComposeParams);
+ var params = Cc[MsgComposeParamsContractID]
+ .createInstance(nsIMsgComposeParams);
msgCompose.initialize(params);
// Test - expandMailingLists basic functionality.
// Re-initialize
- msgCompose = Components.classes[MsgComposeContractID]
- .createInstance(nsIMsgCompose);
+ msgCompose = Cc[MsgComposeContractID]
+ .createInstance(nsIMsgCompose);
// Set up some basic fields for compose.
- var fields = Components.classes[MsgComposeFieldsContractID]
- .createInstance(nsIMsgCompFields);
+ var fields = Cc[MsgComposeFieldsContractID]
+ .createInstance(nsIMsgCompFields);
// These aren't in the address book copied above.
fields.from = "test1@foo1.invalid";
fields.to = "test2@foo1.invalid";
fields.cc = "test3@foo1.invalid";
fields.bcc = "test4@foo1.invalid";
// Set up some params
- params = Components.classes[MsgComposeParamsContractID]
- .createInstance(nsIMsgComposeParams);
+ params = Cc[MsgComposeParamsContractID]
+ .createInstance(nsIMsgComposeParams);
params.composeFields = fields;
msgCompose.initialize(params);
msgCompose.expandMailingLists();
Assert.equal(fields.to, "test2@foo1.invalid");
Assert.equal(fields.cc, "test3@foo1.invalid");
--- a/mailnews/compose/test/unit/test_nsMsgCompose2.js
+++ b/mailnews/compose/test/unit/test_nsMsgCompose2.js
@@ -1,18 +1,18 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Test suite for nsMsgCompose functions relating to send listeners.
*/
var MsgComposeContractID = "@mozilla.org/messengercompose/compose;1";
-var nsIMsgCompose = Components.interfaces.nsIMsgCompose;
+var nsIMsgCompose = Ci.nsIMsgCompose;
-var gMsgCompose = Components.classes[MsgComposeContractID]
- .createInstance(nsIMsgCompose);
+var gMsgCompose = Cc[MsgComposeContractID]
+ .createInstance(nsIMsgCompose);
var numSendListenerFunctions = 6;
var gSLAll = new Array(numSendListenerFunctions + 1);
function sendListener() {}
sendListener.prototype = {
--- a/mailnews/compose/test/unit/test_nsMsgCompose4.js
+++ b/mailnews/compose/test/unit/test_nsMsgCompose4.js
@@ -1,47 +1,47 @@
/**
* Tests nsMsgCompose determineHTMLAction.
*/
var MsgComposeContractID = "@mozilla.org/messengercompose/compose;1";
var MsgComposeParamsContractID = "@mozilla.org/messengercompose/composeparams;1";
var MsgComposeFieldsContractID = "@mozilla.org/messengercompose/composefields;1";
-var nsIMsgCompose = Components.interfaces.nsIMsgCompose;
-var nsIMsgComposeParams = Components.interfaces.nsIMsgComposeParams;
-var nsIMsgCompConvertible = Components.interfaces.nsIMsgCompConvertible;
-var nsIMsgCompFields = Components.interfaces.nsIMsgCompFields;
-var SendFormat = Components.interfaces.nsIMsgCompSendFormat;
+var nsIMsgCompose = Ci.nsIMsgCompose;
+var nsIMsgComposeParams = Ci.nsIMsgComposeParams;
+var nsIMsgCompConvertible = Ci.nsIMsgCompConvertible;
+var nsIMsgCompFields = Ci.nsIMsgCompFields;
+var SendFormat = Ci.nsIMsgCompSendFormat;
ChromeUtils.import("resource://gre/modules/Services.jsm");
/**
* Helper to check population worked as expected.
* @param aTo text in the To field
* @param aNewsgroups text for the Newsgroups field
* @param aSendFormat |nsIMsgCompSendFormat| format to send
* @param aConvertible |nsIMsgCompConvertible| parameter to check (defaults to
* nsIMsgCompConvertible.No if undefined)
*/
function checkPopulate(aTo, aNewsgroups, aSendFormat,
aConvertible=nsIMsgCompConvertible.No)
{
- var msgCompose = Components.classes[MsgComposeContractID]
- .createInstance(nsIMsgCompose);
+ var msgCompose = Cc[MsgComposeContractID]
+ .createInstance(nsIMsgCompose);
// Set up some basic fields for compose.
- var fields = Components.classes[MsgComposeFieldsContractID]
- .createInstance(nsIMsgCompFields);
+ var fields = Cc[MsgComposeFieldsContractID]
+ .createInstance(nsIMsgCompFields);
fields.to = aTo;
fields.newsgroups = aNewsgroups;
// Set up some params
- var params = Components.classes[MsgComposeParamsContractID]
- .createInstance(nsIMsgComposeParams);
+ var params = Cc[MsgComposeParamsContractID]
+ .createInstance(nsIMsgComposeParams);
params.composeFields = fields;
msgCompose.initialize(params);
msgCompose.expandMailingLists();
Assert.equal(msgCompose.determineHTMLAction(aConvertible), aSendFormat);
}
@@ -56,44 +56,44 @@ function run_test() {
testAB = do_get_file("../../../data/abLists2.mab");
// Copy the file to the profile directory for a CAB
testAB.copyTo(do_get_profile(), kCABData.fileName);
// Test - Check we can initalize with fewest specified
// parameters and don't fail/crash like we did in bug 411646.
- var msgCompose = Components.classes[MsgComposeContractID]
- .createInstance(nsIMsgCompose);
+ var msgCompose = Cc[MsgComposeContractID]
+ .createInstance(nsIMsgCompose);
// Set up some params
- var params = Components.classes[MsgComposeParamsContractID]
- .createInstance(nsIMsgComposeParams);
+ var params = Cc[MsgComposeParamsContractID]
+ .createInstance(nsIMsgComposeParams);
msgCompose.initialize(params);
// Test - determineHTMLAction basic functionality.
// Re-initialize
- msgCompose = Components.classes[MsgComposeContractID]
- .createInstance(nsIMsgCompose);
+ msgCompose = Cc[MsgComposeContractID]
+ .createInstance(nsIMsgCompose);
// Set up some basic fields for compose.
- var fields = Components.classes[MsgComposeFieldsContractID]
- .createInstance(nsIMsgCompFields);
+ var fields = Cc[MsgComposeFieldsContractID]
+ .createInstance(nsIMsgCompFields);
// These aren't in the address book copied above.
fields.from = "test1@foo1.invalid";
fields.to = "test2@foo1.invalid";
fields.cc = "test3@foo1.invalid";
fields.bcc = "test4@foo1.invalid";
// Set up some params
- params = Components.classes[MsgComposeParamsContractID]
- .createInstance(nsIMsgComposeParams);
+ params = Cc[MsgComposeParamsContractID]
+ .createInstance(nsIMsgComposeParams);
params.composeFields = fields;
msgCompose.initialize(params);
var nonHTMLRecipients = new Object();
Services.prefs.setIntPref("mail.default_html_action", SendFormat.AskUser);
--- a/mailnews/compose/test/unit/test_nsSmtpService1.js
+++ b/mailnews/compose/test/unit/test_nsSmtpService1.js
@@ -1,19 +1,19 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Test suite for nsSmtpService
*/
var SmtpServiceContractID = "@mozilla.org/messengercompose/smtp;1";
-var nsISmtpService = Components.interfaces.nsISmtpService;
+var nsISmtpService = Ci.nsISmtpService;
function run_test() {
- var smtpService = Components.classes[SmtpServiceContractID]
- .getService(nsISmtpService);
+ var smtpService = Cc[SmtpServiceContractID]
+ .getService(nsISmtpService);
// Test - no servers
var smtpServers = smtpService.servers;
Assert.ok(!smtpServers.hasMoreElements());
Assert.equal(smtpService.defaultServer, null);
--- a/mailnews/compose/test/unit/test_sendMailAddressIDN.js
+++ b/mailnews/compose/test/unit/test_sendMailAddressIDN.js
@@ -107,17 +107,17 @@ msgListener.prototype =
// QueryInterface
QueryInterface: function (iid)
{
if (iid.equals(Ci.nsIMsgSendListener) ||
iid.equals(Ci.nsIMsgCopyServiceListener) ||
iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
}
function DoSendTest(aRecipient, aRecipientExpected, aExceptionExpected)
{
server = setupServerDaemon();
server.start();
--- a/mailnews/compose/test/unit/test_sendMessageFile.js
+++ b/mailnews/compose/test/unit/test_sendMessageFile.js
@@ -93,17 +93,17 @@ msl.prototype = {
// QueryInterface
QueryInterface: function (iid) {
if (iid.equals(Ci.nsIMsgSendListener) ||
iid.equals(Ci.nsIMsgCopyServiceListener) ||
iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
}
function run_test() {
server = setupServerDaemon();
type = "sendMessageFile";
--- a/mailnews/compose/test/unit/test_temporaryFilesRemoved.js
+++ b/mailnews/compose/test/unit/test_temporaryFilesRemoved.js
@@ -23,17 +23,17 @@ var progressListener = {
onSecurityChange: function(aWebProgress, aRequest, state) {},
QueryInterface : function(iid) {
if (iid.equals(Ci.nsIWebProgressListener) ||
iid.equals(Ci.nsISupportsWeakReference) ||
iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
};
function get_temporary_files_for(name) {
let file = Services.dirsvc.get("TmpD", Ci.nsIFile);
file.append(name);
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
--- a/mailnews/db/gloda/components/glautocomp.js
+++ b/mailnews/db/gloda/components/glautocomp.js
@@ -494,17 +494,17 @@ function nsAutoCompleteGloda() {
} catch (e) {
logException(e);
}
}
nsAutoCompleteGloda.prototype = {
classID: Components.ID("{3bbe4d77-3f70-4252-9500-bc00c26f476d}"),
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsIAutoCompleteSearch]),
+ Ci.nsIAutoCompleteSearch]),
startSearch: function(aString, aParam, aResult, aListener) {
try {
let result = new nsAutoCompleteGlodaResult(aListener, this, aString);
// save this for hacky access to the search. I somewhat suspect we simply
// should not be using the formal autocomplete mechanism at all.
// Used in glodacomplete.xml.
this.curResult = result;
--- a/mailnews/db/gloda/content/glodacomplete.xml
+++ b/mailnews/db/gloda/content/glodacomplete.xml
@@ -24,27 +24,26 @@
var existingItemsCount = this.richlistbox.childNodes.length;
var item;
// trim the leading/trailing whitespace
var trimmedSearchString = controller.searchString.trim();
// Unescape the URI spec for showing as an entry in the popup
- let url = Components.classes["@mozilla.org/intl/texttosuburi;1"].
- getService(Components.interfaces.nsITextToSubURI).
+ let url = Cc["@mozilla.org/intl/texttosuburi;1"].
+ getService(Ci.nsITextToSubURI).
unEscapeURIForUI("UTF-8", controller.getValueAt(this._currentIndex));
// Unlike our superclass, we create nodes every time because we have
// heterogeneous results and we cannot rely on the XBL bindings to
// to change fast enough.
item = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "richlistitem");
- var glodaCompleter = Components.
- classes["@mozilla.org/autocomplete/search;1?name=gloda"].
+ var glodaCompleter = Cc["@mozilla.org/autocomplete/search;1?name=gloda"].
getService(). //Components.interfaces.nsIAutoCompleteSearch)
wrappedJSObject;
var result = glodaCompleter.curResult;
// set these attributes before we set the class
// so that we can use them from the contructor
var row = result.getObjectAt(this._currentIndex);
var obj = row.item;
@@ -419,17 +418,17 @@
</xul:hbox>
</content>
<implementation implements="nsIDOMXULSelectControlItemElement">
<constructor>
<![CDATA[
let ellipsis = "\u2026";
try {
ellipsis = Services.prefs.getComplexValue("intl.ellipsis",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
} catch (ex) {
// Do nothing.. we already have a default
}
this._identityOverflowEllipsis = document.getAnonymousElementByAttribute(this, "anonid", "identity-overflow-ellipsis");
this._nameOverflowEllipsis = document.getAnonymousElementByAttribute(this, "anonid", "name-overflow-ellipsis");
this._identityOverflowEllipsis.value = ellipsis;
@@ -509,17 +508,17 @@
</xul:vbox>
</content>
<implementation>
<constructor>
<![CDATA[
let ellipsis = "\u2026";
try {
ellipsis = Services.prefs.getComplexValue("intl.ellipsis",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
} catch (ex) {
// Do nothing.. we already have a default
}
this._identityOverflowEllipsis = document.getAnonymousElementByAttribute(this, "anonid", "identity-overflow-ellipsis");
this._nameOverflowEllipsis = document.getAnonymousElementByAttribute(this, "anonid", "name-overflow-ellipsis");
this._identityOverflowEllipsis.value = ellipsis;
--- a/mailnews/db/gloda/modules/datastore.js
+++ b/mailnews/db/gloda/modules/datastore.js
@@ -379,17 +379,17 @@ QueryFromQueryCallback.prototype = {
// call to this.collection._onItemsAdded to propagate things to the
// next concerned subCollection or the actual listener if this is the
// master collection. (Also, call _onQueryCompleted).
QueryFromQueryResolver.onItemsAdded(null, {data: this.collection}, true);
QueryFromQueryResolver.onQueryCompleted({data: this.collection});
}
}
catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
QFQ_LOG.error("Exception:", e);
}
}
finally {
GlodaDatastore._asyncCompleted();
}
}
};
--- a/mailnews/db/gloda/test/unit/base_index_messages.js
+++ b/mailnews/db/gloda/test/unit/base_index_messages.js
@@ -87,17 +87,17 @@ function* test_pending_commit_causes_msg
yield wait_for_gloda_indexer(msgSet, {augment: true});
// force the msgDatabase closed; the sqlite commit will not yet have occurred
get_real_injection_folder(folder).msgDatabase = null;
// make the commit happen, this causes the header to get set.
yield wait_for_gloda_db_flush();
// Force a GC. this will kill off the header and the database, losing data
// if we are not protecting it.
- Components.utils.forceGC();
+ Cu.forceGC();
// now retrieve the header and make sure it has the gloda id set!
let msgHdr = msgSet.getMsgHdr(0);
Assert.equal(msgHdr.getUint32Property("gloda-id"), msgSet.glodaMessages[0].id);
}
/**
* Give the indexing sweep a workout.
--- a/mailnews/db/gloda/test/unit/resources/glodaTestHelper.js
+++ b/mailnews/db/gloda/test/unit/resources/glodaTestHelper.js
@@ -1304,18 +1304,18 @@ function makeABCardForAddressPair(nameAn
// XXX bug 314448 demands that we trigger creation of the ABs... If we don't
// do this, then the call to addCard will fail if someone else hasn't tickled
// this.
MailServices.ab.directories;
// kPABData is from abSetup.js
let addressBook = MailServices.ab.getDirectory(kPABData.URI);
- let card = Components.classes["@mozilla.org/addressbook/cardproperty;1"]
- .createInstance(Components.interfaces.nsIAbCard);
+ let card = Cc["@mozilla.org/addressbook/cardproperty;1"]
+ .createInstance(Ci.nsIAbCard);
card.displayName = nameAndAddress[0];
card.primaryEmail = nameAndAddress[1];
// Just save the new node straight away.
addressBook.addCard(card);
mark_action("glodaTestHelper",
"adding address book card for:", nameAndAddress);
--- a/mailnews/db/gloda/test/unit/test_fts3_tokenizer.js
+++ b/mailnews/db/gloda/test/unit/test_fts3_tokenizer.js
@@ -188,17 +188,17 @@ function msgSearchExpectCount(aCount, aF
}
},
handleError: function(aError) {
do_throw(new Error("Error: " + aError.message));
},
handleCompletion: function(aReason) {
- if (aReason != Components.interfaces.mozIStorageStatementCallback.REASON_FINISHED)
+ if (aReason != Ci.mozIStorageStatementCallback.REASON_FINISHED)
do_throw(new Error("Query canceled or aborted!"));
if (i != aCount) {
mark_failure(["Didn't get the expected number of rows: got", i,
"expected", aCount, "SQL:", sql]);
do_throw();
}
async_driver();
--- a/mailnews/db/msgdb/test/unit/test_maildb.js
+++ b/mailnews/db/msgdb/test/unit/test_maildb.js
@@ -8,18 +8,18 @@ load("../../../../resources/messageGener
var dbService;
var gTestFolder;
var gCurTestNum = 0;
var kNumTestMessages = 10;
var gTestArray =
[
function test_db_open() {
- dbService = Components.classes["@mozilla.org/msgDatabase/msgDBService;1"]
- .getService(Components.interfaces.nsIMsgDBService);
+ dbService = Cc["@mozilla.org/msgDatabase/msgDBService;1"]
+ .getService(Ci.nsIMsgDBService);
// Get the root folder
let root = localAccountUtils.incomingServer.rootFolder;
root.createSubfolder("dbTest", null);
gTestFolder = root.getChildNamed("dbTest");
let db = dbService.openFolderDB(gTestFolder, true);
Assert.notEqual(db, null);
db.dBFolderInfo.highWater = 10;
db.Close(true);
--- a/mailnews/extensions/dsn/src/dsn-service.js
+++ b/mailnews/extensions/dsn/src/dsn-service.js
@@ -11,14 +11,14 @@ DSNService.prototype = {
name: "dsn",
chromePackageName: "messenger",
showPanel: function(server) {
// don't show the panel for news, rss, or local accounts
return (server.type != "nntp" && server.type != "rss" &&
server.type != "none");
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIMsgAccountManagerExtension]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIMsgAccountManagerExtension]),
classID: Components.ID("{849dab91-9bc9-4508-a0ee-c2453e7c092d}"),
};
var components = [DSNService];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/mailnews/extensions/mdn/src/mdn-service.js
+++ b/mailnews/extensions/mdn/src/mdn-service.js
@@ -11,14 +11,14 @@ MDNService.prototype = {
name: "mdn",
chromePackageName: "messenger",
showPanel: function(server) {
// don't show the panel for news, rss, im or local accounts
return (server.type != "nntp" && server.type != "rss" &&
server.type != "im" && server.type != "none");
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIMsgAccountManagerExtension]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIMsgAccountManagerExtension]),
classID: Components.ID("{e007d92e-1dd1-11b2-a61e-dc962c9b8571}"),
};
var components = [MDNService];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/mailnews/extensions/mdn/test/unit/test_askuser.js
+++ b/mailnews/extensions/mdn/test/unit/test_askuser.js
@@ -13,18 +13,18 @@ localAccount.defaultIdentity = identity;
function run_test()
{
var headers =
"from: alice@t1.example.com\r\n" +
"to: bob@t2.example.net\r\n" +
"return-path: alice@t1.example.com\r\n" +
"Disposition-Notification-To: alice@t1.example.com\r\n";
- let mimeHdr = Components.classes["@mozilla.org/messenger/mimeheaders;1"]
- .createInstance(Components.interfaces.nsIMimeHeaders);
+ let mimeHdr = Cc["@mozilla.org/messenger/mimeheaders;1"]
+ .createInstance(Ci.nsIMimeHeaders);
mimeHdr.initialize(headers);
let receivedHeader = mimeHdr.extractHeader("To", false);
dump(receivedHeader+"\n");
let localFolder = localAccountUtils.inboxFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
localAccountUtils.inboxFolder.addMessage("From \r\n"+ headers + "\r\nhello\r\n");
// Need to setup some prefs
Services.prefs.setBoolPref("mail.mdn.report.enabled", true);
@@ -34,18 +34,18 @@ function run_test()
var msgFolder = localAccountUtils.inboxFolder;
var msgWindow = {};
var msgHdr = mailTestUtils.firstMsgHdr(localAccountUtils.inboxFolder);
// Everything looks good so far, let's generate the MDN response.
- var mdnGenerator = Components.classes["@mozilla.org/messenger-mdn/generator;1"]
- .createInstance(Components.interfaces.nsIMsgMdnGenerator);
+ var mdnGenerator = Cc["@mozilla.org/messenger-mdn/generator;1"]
+ .createInstance(Ci.nsIMsgMdnGenerator);
const MDN_DISPOSE_TYPE_DISPLAYED = 0;
Services.prefs.setIntPref("mail.mdn.report.outside_domain", 1);
var askUser = mdnGenerator.process(MDN_DISPOSE_TYPE_DISPLAYED, msgWindow, msgFolder,
msgHdr.messageKey, mimeHdr, false);
Assert.ok(!askUser);
Services.prefs.setIntPref("mail.mdn.report.outside_domain", 2);
--- a/mailnews/extensions/mdn/test/unit/test_mdnFlags.js
+++ b/mailnews/extensions/mdn/test/unit/test_mdnFlags.js
@@ -20,18 +20,18 @@ localAccount.defaultIdentity = identity;
function run_test()
{
var headers =
"from: alice@t1.example.com\r\n" +
"to: bob@t2.example.net\r\n" +
"return-path: alice@t1.example.com\r\n" +
"Disposition-Notification-To: alice@t1.example.com\r\n";
- let mimeHdr = Components.classes["@mozilla.org/messenger/mimeheaders;1"]
- .createInstance(Components.interfaces.nsIMimeHeaders);
+ let mimeHdr = Cc["@mozilla.org/messenger/mimeheaders;1"]
+ .createInstance(Ci.nsIMimeHeaders);
mimeHdr.initialize(headers);
let receivedHeader = mimeHdr.extractHeader("To", false);
let localFolder = localAccountUtils.inboxFolder.QueryInterface(Ci.nsIMsgLocalMailFolder);
localAccountUtils.inboxFolder.addMessage("From \r\n"+ headers + "\r\nhello\r\n");
// Need to setup some prefs
Services.prefs.setBoolPref("mail.mdn.report.enabled", true);
Services.prefs.setIntPref("mail.mdn.report.not_in_to_cc", 2);
@@ -40,18 +40,18 @@ function run_test()
var msgFolder = localAccountUtils.inboxFolder;
var msgWindow = {};
var msgHdr = mailTestUtils.firstMsgHdr(localAccountUtils.inboxFolder);
// Everything looks good so far, let's generate the MDN response.
- var mdnGenerator = Components.classes["@mozilla.org/messenger-mdn/generator;1"]
- .createInstance(Components.interfaces.nsIMsgMdnGenerator);
+ var mdnGenerator = Cc["@mozilla.org/messenger-mdn/generator;1"]
+ .createInstance(Ci.nsIMsgMdnGenerator);
const MDN_DISPOSE_TYPE_DISPLAYED = 0;
mdnGenerator.process(MDN_DISPOSE_TYPE_DISPLAYED, msgWindow, msgFolder,
msgHdr.messageKey, mimeHdr, false);
mdnGenerator.userDeclined();
Assert.notEqual(msgHdr.flags & Ci.nsMsgMessageFlags.MDNReportSent, 0);
Assert.equal(msgHdr.flags & Ci.nsMsgMessageFlags.MDNReportNeeded, 0);
}
--- a/mailnews/extensions/newsblog/content/newsblogOverlay.js
+++ b/mailnews/extensions/newsblog/content/newsblogOverlay.js
@@ -58,31 +58,31 @@ var FeedMessageHandler = {
* be in an rss acount type folder. In Tb15 and later, a flag is set on the
* message itself upon initial store; the message can be moved to any folder.
*
* @param nsIMsgDBHdr aMsgHdr - the message.
*
* @return true if message is a feed, false if not.
*/
isFeedMessage: function(aMsgHdr) {
- return Boolean(aMsgHdr instanceof Components.interfaces.nsIMsgDBHdr &&
- (aMsgHdr.flags & Components.interfaces.nsMsgMessageFlags.FeedMsg ||
+ return Boolean(aMsgHdr instanceof Ci.nsIMsgDBHdr &&
+ (aMsgHdr.flags & Ci.nsMsgMessageFlags.FeedMsg ||
this.isFeedFolder(aMsgHdr.folder)));
},
/**
* Determine if a folder is a feed acount folder. Trash or a folder in Trash
* should be checked with FeedUtils.isInTrash() if required.
*
* @param nsIMsgFolder aFolder - the folder.
*
* @return true if folder's server.type is in FeedAccountTypes, false if not.
*/
isFeedFolder: function(aFolder) {
- return Boolean(aFolder instanceof Components.interfaces.nsIMsgFolder &&
+ return Boolean(aFolder instanceof Ci.nsIMsgFolder &&
this.FeedAccountTypes.includes(aFolder.server.type));
},
/**
* Determine whether to show a feed message summary or load a web page in the
* message pane.
*
* @param nsIMsgDBHdr aMsgHdr - the message.
@@ -206,19 +206,19 @@ var FeedMessageHandler = {
uri = Services.io.newURI(url);
}
catch (ex) {
FeedUtils.log.info("FeedMessageHandler.loadWebPage: " +
"invalid Content-Base header url - " + url);
return;
}
if (aWhere.browser)
- Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService)
- .loadURI(uri);
+ Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService)
+ .loadURI(uri);
else if (aWhere.messagepane) {
let loadFlag = getBrowser().webNavigation.LOAD_FLAGS_NONE;
getBrowser().webNavigation.loadURI(url, loadFlag, null, null, null);
}
else if (aWhere.tab)
openContentTab(url, "tab", "^");
else if (aWhere.window)
openContentTab(url, "window", "^");
--- a/mailnews/extensions/offline-startup/js/offlineStartup.js
+++ b/mailnews/extensions/offline-startup/js/offlineStartup.js
@@ -128,37 +128,37 @@ var nsOfflineStartup =
{
this.onProfileStartup();
}
},
QueryInterface: function(aIID)
{
- if (aIID.equals(Components.interfaces.nsIObserver) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIObserver) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
}
function nsOfflineStartupModule()
{
}
nsOfflineStartupModule.prototype =
{
classID: Components.ID("3028a3c8-2165-42a4-b878-398da5d32736"),
_xpcom_factory:
{
createInstance: function(aOuter, aIID)
{
if (aOuter != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
// return the singleton
return nsOfflineStartup.QueryInterface(aIID);
},
lockFactory: function(aLock)
{
// quieten warnings
--- a/mailnews/extensions/smime/content/am-smime.js
+++ b/mailnews/extensions/smime/content/am-smime.js
@@ -1,18 +1,18 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
-var nsIX509CertDB = Components.interfaces.nsIX509CertDB;
+var nsIX509CertDB = Ci.nsIX509CertDB;
var nsX509CertDBContractID = "@mozilla.org/security/x509certdb;1";
-var nsIX509Cert = Components.interfaces.nsIX509Cert;
+var nsIX509Cert = Ci.nsIX509Cert;
var email_signing_cert_usage = 4; // SECCertUsage.certUsageEmailSigner
var email_recipient_cert_usage = 5; // SECCertUsage.certUsageEmailRecipient
var gIdentity;
var gPref = null;
var gEncryptionCertName = null;
var gHiddenEncryptionPolicy = null;
@@ -67,17 +67,17 @@ function smimeInitializeFields()
gEncryptAlways.setAttribute("disabled", true);
gNeverEncrypt.setAttribute("disabled", true);
gSignMessages.setAttribute("disabled", true);
gSignMessages.checked = false;
gEncryptionChoices.value = 0;
}
else {
- var certdb = Components.classes[nsX509CertDBContractID].getService(nsIX509CertDB);
+ var certdb = Cc[nsX509CertDBContractID].getService(nsIX509CertDB);
var x509cert = null;
gEncryptionCertName.value = gIdentity.getUnicharAttribute("encryption_cert_name");
gEncryptionCertName.dbKey = gIdentity.getCharAttribute("encryption_cert_dbkey");
// If we succeed in looking up the certificate by the dbkey pref, then
// append the serial number " [...]" to the display value, and remember the
// displayName in a separate property.
try {
@@ -252,18 +252,18 @@ function askUser(message)
function checkOtherCert(cert, pref, usage, msgNeedCertWantSame, msgWantSame, msgNeedCertWantToSelect, enabler)
{
var otherCertInfo = document.getElementById(pref);
if (otherCertInfo.dbKey == cert.dbKey) {
// All is fine, same cert is now selected for both purposes.
return;
}
- var secMsg = Components.classes["@mozilla.org/nsCMSSecureMessage;1"]
- .getService(Components.interfaces.nsICMSSecureMessage);
+ var secMsg = Cc["@mozilla.org/nsCMSSecureMessage;1"]
+ .getService(Ci.nsICMSSecureMessage);
var matchingOtherCert;
if (email_recipient_cert_usage == usage) {
if(secMsg.canBeUsedForEmailEncryption(cert)) {
matchingOtherCert = cert;
}
}
else if (email_signing_cert_usage == usage) {
@@ -301,18 +301,18 @@ function checkOtherCert(cert, pref, usag
}
function smimeSelectCert(smime_cert)
{
var certInfo = document.getElementById(smime_cert);
if (!certInfo)
return;
- var picker = Components.classes["@mozilla.org/user_cert_picker;1"]
- .createInstance(Components.interfaces.nsIUserCertPicker);
+ var picker = Cc["@mozilla.org/user_cert_picker;1"]
+ .createInstance(Ci.nsIUserCertPicker);
var canceled = new Object;
var x509cert = 0;
var certUsage;
var selectEncryptionCert;
if (smime_cert == kEncryptionCertPref) {
selectEncryptionCert = true;
certUsage = email_recipient_cert_usage;
--- a/mailnews/extensions/smime/content/certFetchingStatus.js
+++ b/mailnews/extensions/smime/content/certFetchingStatus.js
@@ -10,17 +10,17 @@
In onload, kick off binding to LDAP.
When bound, kick off the searches.
On finding certificates, import into permanent cert database.
When all searches are finished, close the dialog.
*/
ChromeUtils.import("resource://gre/modules/Services.jsm");
-var nsIX509CertDB = Components.interfaces.nsIX509CertDB;
+var nsIX509CertDB = Ci.nsIX509CertDB;
var nsX509CertDB = "@mozilla.org/security/x509certdb;1";
var CertAttribute = "usercertificate;binary";
var gEmailAddresses;
var gDirectoryPref;
var gLdapServerURL;
var gLdapConnection;
var gCertDB;
@@ -49,23 +49,23 @@ function search()
} catch (ex) {
// if we don't have this pref, no big deal
}
try {
let url = Services.prefs.getCharPref(gDirectoryPref + ".uri");
gLdapServerURL = Services.io
- .newURI(url).QueryInterface(Components.interfaces.nsILDAPURL);
+ .newURI(url).QueryInterface(Ci.nsILDAPURL);
- gLdapConnection = Components.classes["@mozilla.org/network/ldap-connection;1"]
- .createInstance().QueryInterface(Components.interfaces.nsILDAPConnection);
+ gLdapConnection = Cc["@mozilla.org/network/ldap-connection;1"]
+ .createInstance().QueryInterface(Ci.nsILDAPConnection);
gLdapConnection.init(gLdapServerURL, gLogin, new boundListener(),
- null, Components.interfaces.nsILDAPConnection.VERSION3);
+ null, Ci.nsILDAPConnection.VERSION3);
} catch (ex) {
dump(ex);
dump(" exception creating ldap connection\n");
window.close();
}
}
@@ -79,43 +79,43 @@ function stopFetching()
}
}
return true;
}
function importCert(ber_value)
{
if (!gCertDB) {
- gCertDB = Components.classes[nsX509CertDB].getService(nsIX509CertDB);
+ gCertDB = Cc[nsX509CertDB].getService(nsIX509CertDB);
}
var cert_length = new Object();
var cert_bytes = ber_value.get(cert_length);
if (cert_bytes) {
gCertDB.importEmailCertificate(cert_bytes, cert_length.value, null);
}
}
function getLDAPOperation()
{
- gLdapOperation = Components.classes["@mozilla.org/network/ldap-operation;1"]
- .createInstance().QueryInterface(Components.interfaces.nsILDAPOperation);
+ gLdapOperation = Cc["@mozilla.org/network/ldap-operation;1"]
+ .createInstance().QueryInterface(Ci.nsILDAPOperation);
gLdapOperation.init(gLdapConnection,
new ldapMessageListener(),
null);
}
function getPassword()
{
// we only need a password if we are using credentials
if (gLogin)
{
- let authPrompter = Services.ww.getNewAuthPrompter(window.QueryInterface(Components.interfaces.nsIDOMWindow));
+ let authPrompter = Services.ww.getNewAuthPrompter(window.QueryInterface(Ci.nsIDOMWindow));
let strBundle = document.getElementById('bundle_ldap');
let password = { value: "" };
// nsLDAPAutocompleteSession uses asciiHost instead of host for the prompt text, I think we should be
// consistent.
if (authPrompter.promptPassword(strBundle.getString("authPromptTitle"),
strBundle.getFormattedString("authPromptText", [gLdapServerURL.asciiHost]),
gLdapServerURL.spec,
@@ -193,21 +193,21 @@ function kickOffSearch()
}
function boundListener() {
}
boundListener.prototype.QueryInterface =
function(iid) {
- if (iid.equals(Components.interfaces.nsISupports) ||
- iid.equals(Components.interfaces.nsILDAPMessageListener))
+ if (iid.equals(Ci.nsISupports) ||
+ iid.equals(Ci.nsILDAPMessageListener))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
boundListener.prototype.onLDAPMessage =
function(aMessage) {
}
boundListener.prototype.onLDAPInit =
function(aConn, aStatus) {
@@ -215,41 +215,41 @@ boundListener.prototype.onLDAPInit =
}
function ldapMessageListener() {
}
ldapMessageListener.prototype.QueryInterface =
function(iid) {
- if (iid.equals(Components.interfaces.nsISupports) ||
- iid.equals(Components.interfaces.nsILDAPMessageListener))
+ if (iid.equals(Ci.nsISupports) ||
+ iid.equals(Ci.nsILDAPMessageListener))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
ldapMessageListener.prototype.onLDAPMessage =
function(aMessage) {
- if (Components.interfaces.nsILDAPMessage.RES_SEARCH_RESULT == aMessage.type) {
+ if (Ci.nsILDAPMessage.RES_SEARCH_RESULT == aMessage.type) {
window.close();
return;
}
- if (Components.interfaces.nsILDAPMessage.RES_BIND == aMessage.type) {
- if (Components.interfaces.nsILDAPErrors.SUCCESS != aMessage.errorCode) {
+ if (Ci.nsILDAPMessage.RES_BIND == aMessage.type) {
+ if (Ci.nsILDAPErrors.SUCCESS != aMessage.errorCode) {
window.close();
}
else {
kickOffSearch();
}
return;
}
- if (Components.interfaces.nsILDAPMessage.RES_SEARCH_ENTRY == aMessage.type) {
+ if (Ci.nsILDAPMessage.RES_SEARCH_ENTRY == aMessage.type) {
var outSize = new Object();
try {
var outBinValues = aMessage.getBinaryValues(CertAttribute, outSize);
var i;
for (i=0; i < outSize.value; ++i) {
importCert(outBinValues[i]);
}
--- a/mailnews/extensions/smime/content/certpicker.js
+++ b/mailnews/extensions/smime/content/certpicker.js
@@ -1,15 +1,15 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
+const nsIDialogParamBlock = Ci.nsIDialogParamBlock;
var dialogParams;
var itemCount = 0;
function onLoad()
{
dialogParams = window.arguments[0].QueryInterface(nsIDialogParamBlock);
--- a/mailnews/extensions/smime/content/msgCompSMIMEOverlay.js
+++ b/mailnews/extensions/smime/content/msgCompSMIMEOverlay.js
@@ -7,34 +7,34 @@ ChromeUtils.import("resource://gre/modul
// Account encryption policy values:
// const kEncryptionPolicy_Never = 0;
// 'IfPossible' was used by ns4.
// const kEncryptionPolicy_IfPossible = 1;
var kEncryptionPolicy_Always = 2;
var gEncryptedURIService =
- Components.classes["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
- .getService(Components.interfaces.nsIEncryptedSMIMEURIsService);
+ Cc["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
+ .getService(Ci.nsIEncryptedSMIMEURIsService);
var gNextSecurityButtonCommand = "";
var gSMFields = null;
var gEncryptOptionChanged;
var gSignOptionChanged;
function onComposerLoad()
{
// Are we already set up ? Or are the required fields missing ?
if (gSMFields || !gMsgCompose || !gMsgCompose.compFields)
return;
gMsgCompose.compFields.securityInfo = null;
- gSMFields = Components.classes["@mozilla.org/messenger-smime/composefields;1"]
- .createInstance(Components.interfaces.nsIMsgSMIMECompFields);
+ gSMFields = Cc["@mozilla.org/messenger-smime/composefields;1"]
+ .createInstance(Ci.nsIMsgSMIMECompFields);
if (!gSMFields)
return;
gMsgCompose.compFields.securityInfo = gSMFields;
// Set up the intial security state.
gSMFields.requireEncryptMessage =
gCurrentIdentity.getIntAttribute("encryptionpolicy") == kEncryptionPolicy_Always;
@@ -262,19 +262,19 @@ function onComposerSendMessage()
let missingCount = new Object();
let emailAddresses = new Object();
try
{
if (!gMsgCompose.compFields.securityInfo.requireEncryptMessage)
return;
- Components.classes["@mozilla.org/messenger-smime/smimejshelper;1"]
- .createInstance(Components.interfaces.nsISMimeJSHelper)
- .getNoCertAddresses(gMsgCompose.compFields,
+ Cc["@mozilla.org/messenger-smime/smimejshelper;1"]
+ .createInstance(Ci.nsISMimeJSHelper)
+ .getNoCertAddresses(gMsgCompose.compFields,
missingCount,
emailAddresses);
}
catch (e)
{
return;
}
--- a/mailnews/extensions/smime/content/msgCompSecurityInfo.js
+++ b/mailnews/extensions/smime/content/msgCompSecurityInfo.js
@@ -11,19 +11,19 @@ var gBundle;
var gEmailAddresses;
var gCertStatusSummaries;
var gCertIssuedInfos;
var gCertExpiresInfos;
var gCerts;
var gCount;
var gSMimeContractID = "@mozilla.org/messenger-smime/smimejshelper;1";
-var gISMimeJSHelper = Components.interfaces.nsISMimeJSHelper;
-var gIX509Cert = Components.interfaces.nsIX509Cert;
-var nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;
+var gISMimeJSHelper = Ci.nsISMimeJSHelper;
+var gIX509Cert = Ci.nsIX509Cert;
+var nsICertificateDialogs = Ci.nsICertificateDialogs;
var nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"
function getStatusExplanation(value)
{
switch (value)
{
case gIX509Cert.VERIFIED_OK:
return gBundle.getString("StatusValid");
@@ -49,17 +49,17 @@ function getStatusExplanation(value)
}
function onLoad()
{
var params = window.arguments[0];
if (!params)
return;
- var helper = Components.classes[gSMimeContractID].createInstance(gISMimeJSHelper);
+ var helper = Cc[gSMimeContractID].createInstance(gISMimeJSHelper);
if (!helper)
return;
gListBox = document.getElementById("infolist");
gViewButton = document.getElementById("viewCertButton");
gBundle = document.getElementById("bundle_smime_comp_info");
@@ -212,17 +212,17 @@ function onLoad()
function onSelectionChange(event)
{
gViewButton.disabled = !(gListBox.selectedItems.length == 1 &&
certForRow(gListBox.selectedIndex));
}
function viewCertHelper(parent, cert) {
- var cd = Components.classes[nsCertificateDialogs].getService(nsICertificateDialogs);
+ var cd = Cc[nsCertificateDialogs].getService(nsICertificateDialogs);
cd.viewCert(parent, cert);
}
function certForRow(aRowIndex) {
return gCerts.value[aRowIndex];
}
function viewSelectedCert()
--- a/mailnews/extensions/smime/content/msgHdrViewSMIMEOverlay.js
+++ b/mailnews/extensions/smime/content/msgHdrViewSMIMEOverlay.js
@@ -13,17 +13,17 @@ var gEncryptedStatusPanel = null;
var gEncryptedURIService = null;
var gMyLastEncryptedURI = null;
var gSMIMEBundle = null;
// var gBrandBundle; -- defined in mailWindow.js
// manipulates some globals from msgReadSMIMEOverlay.js
-var nsICMSMessageErrors = Components.interfaces.nsICMSMessageErrors;
+var nsICMSMessageErrors = Ci.nsICMSMessageErrors;
var smimeHeaderSink =
{
maxWantedNesting: function()
{
return 1;
},
@@ -117,19 +117,19 @@ var smimeHeaderSink =
title+"</font></center><br>\n" +
body+"\n" +
"</td></tr></table></center></body></html>", false);
}
},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIMsgSMIMEHeaderSink) || iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIMsgSMIMEHeaderSink) || iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
};
function forgetEncryptedURI()
{
if (gMyLastEncryptedURI && gEncryptedURIService)
{
gEncryptedURIService.forgetEncrypted(gMyLastEncryptedURI);
@@ -192,18 +192,18 @@ function msgHdrViewSMIMEOnLoad(event)
// add ourself to the list of message display listeners so we get notified when we are about to display a
// message.
var listener = {};
listener.onStartHeaders = onSMIMEStartHeaders;
listener.onEndHeaders = onSMIMEEndHeaders;
gMessageListeners.push(listener);
gEncryptedURIService =
- Components.classes["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
- .getService(Components.interfaces.nsIEncryptedSMIMEURIsService);
+ Cc["@mozilla.org/messenger-smime/smime-encrypted-uris-service;1"]
+ .getService(Ci.nsIEncryptedSMIMEURIsService);
}
function msgHdrViewSMIMEOnUnload(event)
{
window.crypto.enableSmartCardEvents = false;
document.removeEventListener("smartcard-insert", onSmartCardChange);
document.removeEventListener("smartcard-remove", onSmartCardChange);
forgetEncryptedURI();
--- a/mailnews/extensions/smime/content/msgReadSMIMEOverlay.js
+++ b/mailnews/extensions/smime/content/msgReadSMIMEOverlay.js
@@ -42,20 +42,20 @@ function showMessageReadSecurityInfo()
{
let gSignedUINode = document.getElementById("signedHdrIcon");
if (gSignedUINode && gSignedUINode.getAttribute("signed") == "unknown")
{
showImapSignatureUnknown();
return;
}
- let params = Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
- .createInstance(Components.interfaces.nsIDialogParamBlock);
- params.objects = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let params = Cc["@mozilla.org/embedcomp/dialogparam;1"]
+ .createInstance(Ci.nsIDialogParamBlock);
+ params.objects = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
// Append even if null... the receiver must handle that.
params.objects.appendElement(gSignerCert);
params.objects.appendElement(gEncryptionCert);
// int array starts with index 0, but that is used for window exit status
params.SetInt(1, gSignatureStatus);
params.SetInt(2, gEncryptionStatus);
--- a/mailnews/extensions/smime/content/msgReadSecurityInfo.js
+++ b/mailnews/extensions/smime/content/msgReadSecurityInfo.js
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-var nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
-var nsIX509Cert = Components.interfaces.nsIX509Cert;
-var nsICMSMessageErrors = Components.interfaces.nsICMSMessageErrors;
-var nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;
+var nsIDialogParamBlock = Ci.nsIDialogParamBlock;
+var nsIX509Cert = Ci.nsIX509Cert;
+var nsICMSMessageErrors = Ci.nsICMSMessageErrors;
+var nsICertificateDialogs = Ci.nsICertificateDialogs;
var nsCertificateDialogs = "@mozilla.org/nsCertificateDialogs;1"
var gSignerCert = null;
var gEncryptionCert = null;
var gSignatureStatus = -1;
var gEncryptionStatus = -1;
@@ -23,17 +23,17 @@ function setText(id, value) {
element.firstChild.remove();
var textNode = document.createTextNode(value);
element.appendChild(textNode);
}
function onLoad()
{
var paramBlock = window.arguments[0].QueryInterface(nsIDialogParamBlock);
- paramBlock.objects.QueryInterface(Components.interfaces.nsIMutableArray);
+ paramBlock.objects.QueryInterface(Ci.nsIMutableArray);
try {
gSignerCert = paramBlock.objects.queryElementAt(0, nsIX509Cert);
} catch(e) { } // maybe null
try {
gEncryptionCert = paramBlock.objects.queryElementAt(1, nsIX509Cert);
} catch(e) { } // maybe null
gSignatureStatus = paramBlock.GetInt(1);
@@ -103,18 +103,18 @@ function onLoad()
case nsICMSMessageErrors.VERIFY_ERROR_UNVERIFIED:
case nsICMSMessageErrors.VERIFY_ERROR_PROCESSING:
case nsICMSMessageErrors.VERIFY_MALFORMED_SIGNATURE:
sigInfoLabel = "SIInvalidLabel";
sigInfoHeader = "SIInvalidHeader";
sigInfo_clueless = true;
break;
default:
- Components.utils.reportError("Unexpected gSignatureStatus: " +
- gSignatureStatus);
+ Cu.reportError("Unexpected gSignatureStatus: " +
+ gSignatureStatus);
}
document.getElementById("signatureLabel").value =
bundle.getString(sigInfoLabel);
var label;
if (sigInfoHeader) {
label = document.getElementById("signatureHeader");
@@ -153,18 +153,18 @@ function onLoad()
break;
case nsICMSMessageErrors.GENERAL_ERROR:
encInfoLabel = "EIInvalidLabel";
encInfoHeader = "EIInvalidHeader";
encInfo_clueless = 1;
break;
default:
- Components.utils.reportError("Unexpected gEncryptionStatus: " +
- gEncryptionStatus);
+ Cu.reportError("Unexpected gEncryptionStatus: " +
+ gEncryptionStatus);
}
document.getElementById("encryptionLabel").value =
bundle.getString(encInfoLabel);
if (encInfoHeader) {
label = document.getElementById("encryptionHeader");
label.collapsed = false;
@@ -203,17 +203,17 @@ function onLoad()
}
if (gEncryptionCert.issuerName) {
document.getElementById("encCertIssuedBy").value = gEncryptionCert.issuerCommonName;
}
}
}
function viewCertHelper(parent, cert) {
- var cd = Components.classes[nsCertificateDialogs].getService(nsICertificateDialogs);
+ var cd = Cc[nsCertificateDialogs].getService(nsICertificateDialogs);
cd.viewCert(parent, cert);
}
function viewSignatureCert()
{
if (gSignerCert) {
viewCertHelper(window, gSignerCert);
}
--- a/mailnews/extensions/smime/src/smime-service.js
+++ b/mailnews/extensions/smime/src/smime-service.js
@@ -11,14 +11,14 @@ SMIMEService.prototype = {
name: "smime",
chromePackageName: "messenger",
showPanel: function(server) {
// don't show the panel for news, rss, or local accounts
return (server.type != "nntp" && server.type != "rss" &&
server.type != "im" && server.type != "none");
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIMsgAccountManagerExtension]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIMsgAccountManagerExtension]),
classID: Components.ID("{f2809796-1dd1-11b2-8c1b-8f15f007c699}"),
};
var components = [SMIMEService];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/mailnews/imap/test/unit/test_autosync_date_constraints.js
+++ b/mailnews/imap/test/unit/test_autosync_date_constraints.js
@@ -34,17 +34,17 @@ var tests = [
IMAPPump.inbox.applyRetentionSettings();
let enumerator = IMAPPump.inbox.msgDatabase.EnumerateMessages();
if (enumerator) {
let now = new Date();
let dateInSeconds = now.getSeconds();
let cutOffDateInSeconds = dateInSeconds - (5 * 60 * 24);
while (enumerator.hasMoreElements()) {
let header = enumerator.getNext();
- if (header instanceof Components.interfaces.nsIMsgDBHdr) {
+ if (header instanceof Ci.nsIMsgDBHdr) {
if (header.dateInSeconds < cutOffDateInSeconds)
Assert.equal(header.getStringProperty("pendingRemoval"), "1");
else
Assert.equal(header.getStringProperty("pendingRemoval"), "");
}
}
}
},
--- a/mailnews/imap/test/unit/test_compactOfflineStore.js
+++ b/mailnews/imap/test/unit/test_compactOfflineStore.js
@@ -62,17 +62,17 @@ function checkOfflineStore(prevOfflineSt
let enumerator = IMAPPump.inbox.msgDatabase.EnumerateMessages();
if (enumerator)
{
while (enumerator.hasMoreElements())
{
let header = enumerator.getNext();
// this will verify that the message in the offline store
// starts with "From " - otherwise, it returns an error.
- if (header instanceof Components.interfaces.nsIMsgDBHdr &&
+ if (header instanceof Ci.nsIMsgDBHdr &&
(header.flags & Ci.nsMsgMessageFlags.Offline))
IMAPPump.inbox.getOfflineFileStream(header.messageKey, offset, size).close();
}
}
// check that the offline store shrunk by at least 100 bytes.
// (exact calculation might be fragile).
Assert.ok(prevOfflineStoreSize > IMAPPump.inbox.filePath.fileSize + 100);
}
--- a/mailnews/imap/test/unit/test_downloadOffline.js
+++ b/mailnews/imap/test/unit/test_downloadOffline.js
@@ -53,17 +53,17 @@ function *downloadAllForOffline() {
function verifyDownloaded() {
// verify that the message headers have the offline flag set.
let msgEnumerator = IMAPPump.inbox.msgDatabase.EnumerateMessages();
let offset = {};
let size = {};
while (msgEnumerator.hasMoreElements()) {
let header = msgEnumerator.getNext();
// Verify that each message has been downloaded and looks OK.
- if (header instanceof Components.interfaces.nsIMsgDBHdr &&
+ if (header instanceof Ci.nsIMsgDBHdr &&
(header.flags & Ci.nsMsgMessageFlags.Offline))
IMAPPump.inbox.getOfflineFileStream(header.messageKey, offset, size).close();
else
do_throw("Message not downloaded for offline use");
}
}
function run_test() {
--- a/mailnews/imap/test/unit/test_imapAutoSync.js
+++ b/mailnews/imap/test/unit/test_imapAutoSync.js
@@ -183,27 +183,27 @@ var gAutoSyncListener =
throw(e);
}
},
onFolderAddedIntoQ : function(queue, folder) {
try {
let queueName = "";
dump("folder added into Q " + this.qName(queue) + " " + folder.URI + "\n");
- if (folder instanceof Components.interfaces.nsIMsgFolder &&
+ if (folder instanceof Ci.nsIMsgFolder &&
queue == nsIAutoSyncMgrListener.PriorityQueue) {
}
} catch (e) {
throw(e);
}
},
onFolderRemovedFromQ : function(queue, folder) {
try {
dump("folder removed from Q " + this.qName(queue) + " " + folder.URI + "\n");
- if (folder instanceof Components.interfaces.nsIMsgFolder &&
+ if (folder instanceof Ci.nsIMsgFolder &&
queue == nsIAutoSyncMgrListener.PriorityQueue) {
}
} catch (e) {
throw(e);
}
},
onDownloadStarted : function(folder, numOfMessages, totalPending) {
try {
@@ -211,33 +211,33 @@ var gAutoSyncListener =
} catch (e) {
throw(e);
}
},
onDownloadCompleted : function(folder) {
try {
dump("folder download completed" + folder.URI + "\n");
- if (folder instanceof Components.interfaces.nsIMsgFolder) {
+ if (folder instanceof Ci.nsIMsgFolder) {
let index = mailTestUtils.non_strict_index_of(this._waitingForUpdateList, folder);
if (index != -1)
this._waitingForUpdateList.splice(index, 1);
if (this._waitingForUpdate && this._waitingForUpdateList.length == 0) {
dump("got last folder update looking for\n");
this._waitingForUpdate = false;
async_driver();
}
}
} catch (e) {
throw(e);
}
},
onDownloadError : function(folder) {
- if (folder instanceof Components.interfaces.nsIMsgFolder) {
+ if (folder instanceof Ci.nsIMsgFolder) {
dump("OnDownloadError: " + folder.prettyName + "\n");
}
},
onDiscoveryQProcessed : function (folder, numOfHdrsProcessed, leftToProcess) {
dump("onDiscoveryQProcessed: " + folder.prettyName + "\n");
let index = mailTestUtils.non_strict_index_of(this._waitingForDiscoveryList, folder);
if (index != -1)
--- a/mailnews/imap/test/unit/test_imapFilterActions.js
+++ b/mailnews/imap/test/unit/test_imapFilterActions.js
@@ -39,18 +39,18 @@ var gMessage = "draft1"; // message file
// subject of the test message
var gMessageSubject = "Hello, did you receive my bugmail?";
// a string in the body of the test message
var gMessageInBody = "an HTML message";
// various object references
var gCopyService = MailServices.copy;
-var gDbService = Components.classes["@mozilla.org/msgDatabase/msgDBService;1"]
- .getService(Components.interfaces.nsIMsgDBService);
+var gDbService = Cc["@mozilla.org/msgDatabase/msgDBService;1"]
+ .getService(Ci.nsIMsgDBService);
// Definition of tests. The test function name is the filter action
// being tested, with "Body" appended to tests that use delayed
// application of filters due to a body search
var gTestArray =
[
setupIMAPPump,
// optionally set server parameters, here enabling debug messages
--- a/mailnews/imap/test/unit/test_imapFilterActionsPostplugin.js
+++ b/mailnews/imap/test/unit/test_imapFilterActionsPostplugin.js
@@ -33,18 +33,18 @@ var gMessage = "draft1"; // message file
// subject of the test message
var gMessageSubject = "Hello, did you receive my bugmail?";
// a string in the body of the test message
var gMessageInBody = "an HTML message";
// various object references
-var gDbService = Components.classes["@mozilla.org/msgDatabase/msgDBService;1"]
- .getService(Components.interfaces.nsIMsgDBService);
+var gDbService = Cc["@mozilla.org/msgDatabase/msgDBService;1"]
+ .getService(Ci.nsIMsgDBService);
// Definition of tests. The test function name is the filter action
// being tested, with "Body" appended to tests that use delayed
// application of filters due to a body search
var gTestArray =
[
setupIMAPPump,
setupFilters,
--- a/mailnews/imap/test/unit/test_imapHighWater.js
+++ b/mailnews/imap/test/unit/test_imapHighWater.js
@@ -91,27 +91,27 @@ function* setupFolders() {
yield true;
}
function* doMoves() {
// update folders to download headers.
gIMAPInbox.updateFolderWithListener(null, UrlListener);
yield false;
gFolder1 = gRootFolder.getChildNamed("folder 1")
- .QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ .QueryInterface(Ci.nsIMsgImapMailFolder);
gFolder1.updateFolderWithListener(null, UrlListener);
yield false;
// get five messages to move from Inbox to folder 1.
let headers1 = Cc["@mozilla.org/array;1"]
.createInstance(Ci.nsIMutableArray);
let msgEnumerator = gIMAPInbox.msgDatabase.EnumerateMessages();
for (let i = 0; i < 5 && msgEnumerator.hasMoreElements(); i++)
{
let header = msgEnumerator.getNext();
- if (header instanceof Components.interfaces.nsIMsgDBHdr)
+ if (header instanceof Ci.nsIMsgDBHdr)
headers1.appendElement(header);
}
// this will add dummy headers with keys > 0xffffff80
MailServices.copy.CopyMessages(gIMAPInbox, headers1, gFolder1, true,
CopyListener, gDummyMsgWindow, true);
yield false;
gIMAPInbox.updateFolderWithListener(null, UrlListener);
yield false;
@@ -121,17 +121,17 @@ function* doMoves() {
// headers, and thus highWater is recalculated.
Assert.equal(gFolder1.msgDatabase.dBFolderInfo.highWater, 6);
headers1 = Cc["@mozilla.org/array;1"]
.createInstance(Ci.nsIMutableArray);
msgEnumerator = gIMAPInbox.msgDatabase.EnumerateMessages();
for (let i = 0; i < 5 && msgEnumerator.hasMoreElements(); i++)
{
let header = msgEnumerator.getNext();
- if (header instanceof Components.interfaces.nsIMsgDBHdr)
+ if (header instanceof Ci.nsIMsgDBHdr)
headers1.appendElement(header);
}
// Check that CopyMessages will handle having a high highwater mark.
// It will thrown an exception if it can't.
let msgHdr = gFolder1.msgDatabase.CreateNewHdr(0xfffffffd);
gFolder1.msgDatabase.AddNewHdrToDB(msgHdr, false);
MailServices.copy.CopyMessages(gIMAPInbox, headers1, gFolder1, true,
CopyListener, gDummyMsgWindow, true);
--- a/mailnews/imap/test/unit/test_imapUndo.js
+++ b/mailnews/imap/test/unit/test_imapUndo.js
@@ -106,17 +106,17 @@ function setup() {
var listener1 = new alertListener();
MailServices.mailSession.addUserFeedbackListener(listener1);
Services.prefs.setBoolPref("mail.server.server1.autosync_offline_stores", false);
Services.prefs.setBoolPref("mail.server.server1.offline_download", false);
gMsgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
+ .createInstance(Ci.nsIMsgWindow);
gRootFolder = IMAPPump.incomingServer.rootFolder;
// these hacks are required because we've created the inbox before
// running initial folder discovery, and adding the folder bails
// out before we set it as verified online, so we bail out, and
// then remove the INBOX folder since it's not verified.
IMAPPump.inbox.hierarchyDelimiter = '/';
IMAPPump.inbox.verifiedAsOnlineFolder = true;
--- a/mailnews/imap/test/unit/test_largeOfflineStore.js
+++ b/mailnews/imap/test/unit/test_largeOfflineStore.js
@@ -107,17 +107,17 @@ function* check_result() {
// Verify that the message headers have the offline flag set.
let msgEnumerator = IMAPPump.inbox.msgDatabase.EnumerateMessages();
let offset = {};
let size = {};
while (msgEnumerator.hasMoreElements()) {
let header = msgEnumerator.getNext();
// Verify that each message has been downloaded and looks OK.
- if (!(header instanceof Components.interfaces.nsIMsgDBHdr &&
+ if (!(header instanceof Ci.nsIMsgDBHdr &&
(header.flags & Ci.nsMsgMessageFlags.Offline)))
do_throw("Message not downloaded for offline use");
IMAPPump.inbox.getOfflineFileStream(header.messageKey, offset, size).close();
info("Msg hdr offset = " + offset.value);
}
};
--- a/mailnews/imap/test/unit/test_nsIMsgFolderListenerIMAP.js
+++ b/mailnews/imap/test/unit/test_nsIMsgFolderListenerIMAP.js
@@ -31,17 +31,17 @@ var gMsgFile5 = do_get_file("../../../da
// Copied straight from the example files
var gMsgId1 = "200806061706.m56H6RWT004933@mrapp54.mozilla.org";
var gMsgId2 = "200804111417.m3BEHTk4030129@mrapp51.mozilla.org";
var gMsgId3 = "4849BF7B.2030800@example.com";
var gMsgId4 = "bugmail7.m47LtAEf007542@mrapp51.mozilla.org";
var gMsgId5 = "bugmail6.m47LtAEf007542@mrapp51.mozilla.org";
var gMsgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
+ .createInstance(Ci.nsIMsgWindow);
function addFolder(parent, folderName, storeIn)
{
gExpectedEvents = [[gMFNService.folderAdded, parent, folderName, storeIn]];
// No copy listener notification for this
gCurrStatus |= kStatus.onStopCopyDone;
parent.createSubfolder(folderName, null);
--- a/mailnews/imap/test/unit/test_offlineDraftDataloss.js
+++ b/mailnews/imap/test/unit/test_offlineDraftDataloss.js
@@ -171,17 +171,17 @@ var progressListener = {
onSecurityChange: function(aWebProgress, aRequest, state) {},
QueryInterface : function(iid) {
if (iid.equals(Ci.nsIWebProgressListener) ||
iid.equals(Ci.nsISupportsWeakReference) ||
iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
};
/*
* helper functions
*/
// quick shorthand for output of a line of text.
--- a/mailnews/imap/test/unit/test_offlineStoreLocking.js
+++ b/mailnews/imap/test/unit/test_offlineStoreLocking.js
@@ -43,17 +43,17 @@ function checkOfflineStore(prevOfflineSt
let enumerator = IMAPPump.inbox.msgDatabase.EnumerateMessages();
if (enumerator)
{
while (enumerator.hasMoreElements())
{
let header = enumerator.getNext();
// this will verify that the message in the offline store
// starts with "From " - otherwise, it returns an error.
- if (header instanceof Components.interfaces.nsIMsgDBHdr &&
+ if (header instanceof Ci.nsIMsgDBHdr &&
(header.flags & Ci.nsMsgMessageFlags.Offline))
IMAPPump.inbox.getOfflineFileStream(header.messageKey, offset, size).close();
}
}
// check that the offline store shrunk by at least 100 bytes.
// (exact calculation might be fragile).
Assert.ok(prevOfflineStoreSize > IMAPPump.inbox.filePath.fileSize + 100);
}
--- a/mailnews/imap/test/unit/test_saveImapDraft.js
+++ b/mailnews/imap/test/unit/test_saveImapDraft.js
@@ -138,17 +138,17 @@ var progressListener = {
onSecurityChange: function(aWebProgress, aRequest, state) {},
QueryInterface : function(iid) {
if (iid.equals(Ci.nsIWebProgressListener) ||
iid.equals(Ci.nsISupportsWeakReference) ||
iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
};
/*
* helper functions
*/
// quick shorthand for output of a line of text.
--- a/mailnews/import/content/fieldMapImport.js
+++ b/mailnews/import/content/fieldMapImport.js
@@ -11,18 +11,18 @@ var gPreviousButton;
var gNextButton;
var gMoveUpButton;
var gMoveDownButton;
var gListbox;
var gSkipFirstRecordButton;
function OnLoadFieldMapImport()
{
- top.importService = Components.classes["@mozilla.org/import/import-service;1"]
- .getService(Components.interfaces.nsIImportService);
+ top.importService = Cc["@mozilla.org/import/import-service;1"]
+ .getService(Ci.nsIImportService);
// We need a field map object...
// assume we have one passed in? or just make one?
if (window.arguments && window.arguments[0]) {
top.fieldMap = window.arguments[0].fieldMap;
top.addInterface = window.arguments[0].addInterface;
top.dialogResult = window.arguments[0].result;
}
@@ -142,17 +142,17 @@ function ShowSampleData(data)
}
function FetchSampleData(num)
{
if (!top.addInterface)
return false;
var data = top.addInterface.GetData( "sampleData-" + num);
- if (!(data instanceof Components.interfaces.nsISupportsString))
+ if (!(data instanceof Ci.nsISupportsString))
return false;
ShowSampleData( data.data);
return true;
}
function Browse(step)
{
recordNum += step;
--- a/mailnews/import/content/importDialog.js
+++ b/mailnews/import/content/importDialog.js
@@ -22,34 +22,34 @@ var gAddInterface = null;
var gNewFeedAcctCreated = false;
var nsISupportsString = Ci.nsISupportsString;
function OnLoadImportDialog()
{
gImportMsgsBundle = document.getElementById("bundle_importMsgs");
gFeedsBundle = document.getElementById("bundle_feeds");
- gImportService = Components.classes["@mozilla.org/import/import-service;1"]
- .getService(Ci.nsIImportService);
+ gImportService = Cc["@mozilla.org/import/import-service;1"]
+ .getService(Ci.nsIImportService);
gProgressInfo = { };
gProgressInfo.progressWindow = null;
gProgressInfo.importInterface = null;
gProgressInfo.mainWindow = window;
gProgressInfo.intervalState = 0;
gProgressInfo.importSuccess = false;
gProgressInfo.importType = null;
gProgressInfo.localFolderExists = false;
- gSuccessStr = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(nsISupportsString);
- gErrorStr = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(nsISupportsString);
- gInputStr = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(nsISupportsString);
+ gSuccessStr = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(nsISupportsString);
+ gErrorStr = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(nsISupportsString);
+ gInputStr = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(nsISupportsString);
// look in arguments[0] for parameters
if (("arguments" in window) && window.arguments.length >= 1 &&
("importType" in window.arguments[0]) && window.arguments[0].importType)
{
// keep parameters in global for later
gImportType = window.arguments[0].importType;
gProgressInfo.importType = gImportType;
@@ -628,29 +628,29 @@ async function ImportSettings(module, ne
var location = {};
var description = {};
var result = setIntf.AutoLocate(description, location);
if (!result) {
// In this case, we couldn't find the settings
if (location.value != null) {
// Settings were not found, however, they are specified
// in a file, so ask the user for the settings file.
- let filePicker = Components.classes["@mozilla.org/filepicker;1"].createInstance();
+ let filePicker = Cc["@mozilla.org/filepicker;1"].createInstance();
if (filePicker instanceof Ci.nsIFilePicker) {
let file = null;
try {
filePicker.init(window,
gImportMsgsBundle.getString("ImportSelectSettings"),
filePicker.modeOpen);
filePicker.appendFilters(filePicker.filterAll);
file = await promptForFile(filePicker);
}
catch(ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
error.value = null;
return false;
}
if (file != null) {
setIntf.SetLocation(file);
}
else {
error.value = null;
@@ -692,30 +692,30 @@ async function ImportMail(module, succes
return false;
}
var loc = mailInterface.GetData("mailLocation");
if (loc == null) {
// No location found, check to see if we can ask the user.
if (mailInterface.GetStatus("canUserSetLocation") != 0) {
- let filePicker = Components.classes["@mozilla.org/filepicker;1"].createInstance();
+ let filePicker = Cc["@mozilla.org/filepicker;1"].createInstance();
if (filePicker instanceof Ci.nsIFilePicker) {
try {
filePicker.init(window,
gImportMsgsBundle.getString("ImportSelectMailDir"),
filePicker.modeGetFolder);
filePicker.appendFilters(filePicker.filterAll);
let file = await promptForFile(filePicker);
if (!file) {
return false;
}
mailInterface.SetData("mailLocation", file);
} catch(ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
// don't show an error when we return!
return false;
}
}
else {
error.data = gImportMsgsBundle.getString('ImportMailNotFound');
return false;
}
@@ -766,17 +766,17 @@ async function ImportAddress(module, suc
// Couldn't find the address book, see if we can
// as the user for the location or not?
if (gAddInterface.GetStatus("canUserSetLocation") == 0) {
// an autofind address book that could not be found!
error.data = gImportMsgsBundle.getString('ImportAddressNotFound');
return false;
}
- let filePicker = Components.classes["@mozilla.org/filepicker;1"].createInstance();
+ let filePicker = Cc["@mozilla.org/filepicker;1"].createInstance();
if (!(filePicker instanceof Ci.nsIFilePicker)) {
error.data = gImportMsgsBundle.getString('ImportAddressNotFound');
return false;
}
// The address book location was not found.
// Determine if we need to ask for a directory
// or a single file.
@@ -789,17 +789,17 @@ async function ImportAddress(module, suc
gImportMsgsBundle.getString("ImportSelectAddrDir"),
filePicker.modeGetFolder);
filePicker.appendFilters(filePicker.filterAll);
file = await promptForFile(filePicker);
if (file && file.path) {
fileIsDirectory = true;
}
} catch(ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
file = null;
}
}
else {
// ask for file
try {
filePicker.init(window,
gImportMsgsBundle.getString("ImportSelectAddrFile"),
@@ -813,17 +813,17 @@ async function ImportAddress(module, suc
filePicker.appendFilter(addressbookBundle.getString('LDIFFiles'), "*.ldi; *.ldif");
filePicker.appendFilter(addressbookBundle.getString('CSVFiles'), "*.csv");
filePicker.appendFilter(addressbookBundle.getString('TABFiles'), "*.tab; *.txt");
filePicker.appendFilters(filePicker.filterAll);
}
file = await promptForFile(filePicker);
} catch(ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
file = null;
}
}
if (!file) {
return false;
}
--- a/mailnews/jsaccount/test/unit/test_fooUrl.js
+++ b/mailnews/jsaccount/test/unit/test_fooUrl.js
@@ -44,17 +44,17 @@ var tests = [
Assert.equal(url.jsDelegate.wrappedJSObject._hidden, "IAmHidden");
},
// We used to test nsIURI, nsIURL, and nsIMsgMailNewsUrl overrides, but those
// can no longer be overridden.
function test_nsIMsgMessageUrl() {
let url = newURL().QueryInterface(Ci.nsIMsgMessageUrl);
Assert.ok("originalSpec" in url);
- let appDir = Services.dirsvc.get("GreD", Components.interfaces.nsIFile);
+ let appDir = Services.dirsvc.get("GreD", Ci.nsIFile);
Assert.ok(appDir.path);
// test attributes
url.messageFile = appDir;
Assert.equal(url.messageFile.path, appDir.path);
},
function test_msgIJaUrl() {
let url = newURL().QueryInterface(Ci.msgIJaUrl);
url.setUrlType(Ci.nsIMsgMailNewsUrl.eMove);
--- a/mailnews/local/test/unit/test_nsIMsgLocalMailFolder.js
+++ b/mailnews/local/test/unit/test_nsIMsgLocalMailFolder.js
@@ -126,17 +126,17 @@ function subtest_folder_operations(root)
// Test - isAncestorOf
Assert.ok(folder.isAncestorOf(folder2));
Assert.ok(root.isAncestorOf(folder2));
Assert.ok(!folder.isAncestorOf(root));
// Test - FoldersWithFlag
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
folder.setFlag(nsMsgFolderFlags.CheckNew);
Assert.ok(folder.getFlag(nsMsgFolderFlags.CheckNew));
Assert.ok(!folder.getFlag(nsMsgFolderFlags.Offline));
folder.setFlag(nsMsgFolderFlags.Offline);
Assert.ok(folder.getFlag(nsMsgFolderFlags.CheckNew));
Assert.ok(folder.getFlag(nsMsgFolderFlags.Offline));
@@ -155,18 +155,18 @@ function subtest_folder_operations(root)
folder2.setFlag(nsMsgFolderFlags.Offline);
Assert.equal(root.getFolderWithFlags(nsMsgFolderFlags.CheckNew),
folder);
// Test - Move folders around
var folder3 = root.createLocalSubfolder("folder3");
- var folder3Local = folder3.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
- var folder1Local = folder.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
+ var folder3Local = folder3.QueryInterface(Ci.nsIMsgLocalMailFolder);
+ var folder1Local = folder.QueryInterface(Ci.nsIMsgLocalMailFolder);
// put a single message in folder1.
let messageGenerator = new MessageGenerator();
let message = messageGenerator.makeMessage();
let hdr = folder1Local.addMessage(message.toMboxString());
Assert.equal(message.messageId, hdr.messageId);
folder3Local.copyFolderLocal(folder, true, null, null);
@@ -193,17 +193,17 @@ function subtest_folder_operations(root)
dump("shouldn't exist - folder2 file path " + folder2.URI + "\n");
Assert.ok(!folder2.filePath.exists());
// make sure getting the db doesn't throw an exception
let db = folder1Moved.msgDatabase;
Assert.ok(db.summaryValid);
// Move folders back, get them
- var rootLocal = root.QueryInterface(Components.interfaces.nsIMsgLocalMailFolder);
+ var rootLocal = root.QueryInterface(Ci.nsIMsgLocalMailFolder);
rootLocal.copyFolderLocal(folder1Moved, true, null, null);
folder = root.getChildNamed("folder1");
folder2 = folder.getChildNamed("folder2");
// Test - Rename (test that .msf file is renamed as well)
folder.rename("folder1-newname", null);
// make sure getting the db doesn't throw an exception, and is valid
folder = rootLocal.getChildNamed("folder1-newname");
--- a/mailnews/local/test/unit/test_undoDelete.js
+++ b/mailnews/local/test/unit/test_undoDelete.js
@@ -41,17 +41,17 @@ var gTestArray =
},
];
function run_test()
{
configure_message_injection({mode: "local"});
gMsgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
+ .createInstance(Ci.nsIMsgWindow);
var messageGenerator = new MessageGenerator();
gMsg1 = messageGenerator.makeMessage();
let msg2 = messageGenerator.makeMessage({inReplyTo: gMsg1});
let messages = [];
messages = messages.concat([gMsg1, msg2]);
let msgSet = new SyntheticMessageSet(messages);
--- a/mailnews/mime/src/jsmime.jsm
+++ b/mailnews/mime/src/jsmime.jsm
@@ -24,23 +24,23 @@ var EXPORTED_SYMBOLS = ["jsmime"];
function FakeTextDecoder(label="UTF-8", options = {}) {
this._reset(label);
// So nsIScriptableUnicodeConverter only gives us fatal=false, unless we are
// using UTF-8, where we only get fatal=true. The internals of said class tell
// us to use a C++-only class if we need better behavior.
}
FakeTextDecoder.prototype = {
_reset: function (label) {
- this._encoder = Components.classes[
+ this._encoder = Cc[
"@mozilla.org/intl/scriptableunicodeconverter"]
- .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+ .createInstance(Ci.nsIScriptableUnicodeConverter);
this._encoder.isInternal = true;
- let manager = Components.classes[
+ let manager = Cc[
"@mozilla.org/charset-converter-manager;1"]
- .createInstance(Components.interfaces.nsICharsetConverterManager);
+ .createInstance(Ci.nsICharsetConverterManager);
this._encoder.charset = manager.getCharsetAlias(label);
},
get encoding() { return this._encoder.charset; },
decode: function (input, options = {}) {
let more = 'stream' in options ? options.stream : false;
let result = "";
if (input !== undefined) {
let data = new Uint8Array(input);
@@ -49,17 +49,17 @@ FakeTextDecoder.prototype = {
// This isn't quite right--it won't handle errors if there are a few
// remaining bytes in the buffer, but it's the best we can do.
if (!more)
this._reset(this.encoding);
return result;
},
};
-var {TextDecoder} = Components.utils.getGlobalForObject(
+var {TextDecoder} = Cu.getGlobalForObject(
ChromeUtils.import("resource://gre/modules/Services.jsm", {}));
var RealTextDecoder = TextDecoder;
function FallbackTextDecoder(charset, options) {
try {
return new RealTextDecoder(charset, options);
} catch (e) {
@@ -68,27 +68,27 @@ function FallbackTextDecoder(charset, op
}
TextDecoder = FallbackTextDecoder;
// The following code loads custom MIME encoders.
var CATEGORY_NAME = "custom-mime-encoder";
Services.obs.addObserver(function (subject, topic, data) {
- subject = subject.QueryInterface(Components.interfaces.nsISupportsCString)
+ subject = subject.QueryInterface(Ci.nsISupportsCString)
.data;
if (data == CATEGORY_NAME) {
let url = catman.getCategoryEntry(CATEGORY_NAME, subject);
Services.scriptloader.loadSubScript(url, {}, "UTF-8");
}
}, "xpcom-category-entry-added");
-var catman = Components.classes["@mozilla.org/categorymanager;1"]
- .getService(Components.interfaces.nsICategoryManager);
+var catman = Cc["@mozilla.org/categorymanager;1"]
+ .getService(Ci.nsICategoryManager);
var entries = catman.enumerateCategory(CATEGORY_NAME);
while (entries.hasMoreElements()) {
let string = entries.getNext()
- .QueryInterface(Components.interfaces.nsISupportsCString)
+ .QueryInterface(Ci.nsISupportsCString)
.data;
let url = catman.getCategoryEntry(CATEGORY_NAME, string);
Services.scriptloader.loadSubScript(url, {}, "UTF-8");
}
--- a/mailnews/mime/src/mimeJSComponents.js
+++ b/mailnews/mime/src/mimeJSComponents.js
@@ -14,32 +14,32 @@ function HeaderHandler() {
}
function StringEnumerator(iterator) {
this._iterator = iterator;
this._next = undefined;
}
StringEnumerator.prototype = {
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsIUTF8StringEnumerator]),
+ Ci.nsIUTF8StringEnumerator]),
_setNext: function () {
if (this._next !== undefined)
return;
this._next = this._iterator.next();
},
hasMore: function () {
this._setNext();
return !this._next.done;
},
getNext: function () {
this._setNext();
let result = this._next;
this._next = undefined;
if (result.done)
- throw Components.results.NS_ERROR_UNEXPECTED;
+ throw Cr.NS_ERROR_UNEXPECTED;
return result.value;
}
};
/**
* If we get XPConnect-wrapped objects for msgIAddressObjects, we will have
* properties defined for 'group' that throws off jsmime. This function converts
* the addresses into the form that jsmime expects.
@@ -73,25 +73,25 @@ MimeStructuredHeaders.prototype = {
hasHeader: function (aHeaderName) {
return this._headers.has(aHeaderName.toLowerCase());
},
getUnstructuredHeader: function (aHeaderName) {
let result = this.getHeader(aHeaderName);
if (result === undefined || typeof result == "string")
return result;
- throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+ throw Cr.NS_ERROR_ILLEGAL_VALUE;
},
getAddressingHeader: function (aHeaderName, aPreserveGroups, count) {
let addrs = this.getHeader(aHeaderName);
if (addrs === undefined) {
addrs = [];
} else if (!Array.isArray(addrs)) {
- throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+ throw Cr.NS_ERROR_ILLEGAL_VALUE;
}
return fixArray(addrs, aPreserveGroups, count);
},
getRawHeader: function (aHeaderName) {
let result = this.getHeader(aHeaderName);
if (result === undefined)
return result;
@@ -128,26 +128,26 @@ MimeStructuredHeaders.prototype = {
function MimeHeaders() {
}
MimeHeaders.prototype = {
__proto__: MimeStructuredHeaders.prototype,
classDescription: "Mime headers implementation",
classID: Components.ID("d1258011-f391-44fd-992e-c6f4b461a42f"),
contractID: "@mozilla.org/messenger/mimeheaders;1",
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIMimeHeaders,
- Components.interfaces.msgIStructuredHeaders]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIMimeHeaders,
+ Ci.msgIStructuredHeaders]),
initialize: function MimeHeaders_initialize(allHeaders) {
this._headers = MimeParser.extractHeaders(allHeaders);
},
extractHeader: function MimeHeaders_extractHeader(header, getAll) {
if (!this._headers)
- throw Components.results.NS_ERROR_NOT_INITIALIZED;
+ throw Cr.NS_ERROR_NOT_INITIALIZED;
// Canonicalized to lower-case form
header = header.toLowerCase();
if (!this._headers.has(header))
return null;
var values = this._headers.getRawHeader(header);
if (getAll)
return values.join(",\r\n\t");
else
@@ -161,18 +161,18 @@ MimeHeaders.prototype = {
function MimeWritableStructuredHeaders() {
this._headers = new Map();
}
MimeWritableStructuredHeaders.prototype = {
__proto__: MimeStructuredHeaders.prototype,
classID: Components.ID("c560806a-425f-4f0f-bf69-397c58c599a7"),
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.msgIStructuredHeaders,
- Components.interfaces.msgIWritableStructuredHeaders]),
+ Ci.msgIStructuredHeaders,
+ Ci.msgIWritableStructuredHeaders]),
setHeader: function (aHeaderName, aValue) {
this._headers.set(aHeaderName.toLowerCase(), aValue);
},
deleteHeader: function (aHeaderName) {
this._headers.delete(aHeaderName.toLowerCase());
},
@@ -256,17 +256,17 @@ function fixArray(addresses, preserveGro
count.value = outputArray.length;
return outputArray;
}
function MimeAddressParser() {
}
MimeAddressParser.prototype = {
classID: Components.ID("96bd8769-2d0e-4440-963d-22b97fb3ba77"),
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIMsgHeaderParser]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIMsgHeaderParser]),
parseEncodedHeader: function (aHeader, aCharset, aPreserveGroups, count) {
aHeader = aHeader || "";
let value = MimeParser.parseHeaderField(aHeader,
MimeParser.HEADER_ADDRESS | MimeParser.HEADER_OPTION_ALL_I18N, aCharset);
return fixArray(value, aPreserveGroups, count);
},
parseDecodedHeader: function (aHeader, aPreserveGroups, count) {
@@ -433,17 +433,17 @@ MimeAddressParser.prototype = {
return this.makeMimeHeader([object]);
},
};
function MimeConverter() {
}
MimeConverter.prototype = {
classID: Components.ID("93f8c049-80ed-4dda-9000-94ad8daba44c"),
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIMimeConverter]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIMimeConverter]),
encodeMimePartIIStr_UTF8: function (aHeader, aStructured, aCharset,
aFieldNameLen, aLineLength) {
// The JSMime encoder only works in UTF-8, so if someone requests to not do
// it, they need to change their code.
if (aCharset.toLowerCase() != "utf-8") {
Deprecated.warning("Encoding to non-UTF-8 values is obsolete",
"http://bugzilla.mozilla.org/show_bug.cgi?id=790855");
--- a/mailnews/mime/src/mimeParser.jsm
+++ b/mailnews/mime/src/mimeParser.jsm
@@ -25,17 +25,17 @@ var ExtractHeadersAndBodyEmitter = {
if (partNum == '')
this.body += data;
}
};
/// Sets appropriate default options for chrome-privileged environments
function setDefaultParserOptions(opts) {
if (!("onerror" in opts)) {
- opts.onerror = Components.utils.reportError;
+ opts.onerror = Cu.reportError;
}
}
var MimeParser = {
/**
* Triggers an asynchronous parse of the given input.
*
* The input is an input stream; the stream will be read until EOF and then
--- a/mailnews/mime/test/unit/test_mimeContentType.js
+++ b/mailnews/mime/test/unit/test_mimeContentType.js
@@ -58,18 +58,18 @@ function run_test()
" " +
" " +
" \r\n",
result:
"",
}
];
- let mimeHdr = Components.classes["@mozilla.org/messenger/mimeheaders;1"]
- .createInstance(Components.interfaces.nsIMimeHeaders);
+ let mimeHdr = Cc["@mozilla.org/messenger/mimeheaders;1"]
+ .createInstance(Ci.nsIMimeHeaders);
for (let i = 0; i < headers.length; i++) {
mimeHdr.initialize(headers[i].header);
let receivedHeader = mimeHdr.extractHeader("Content-Type", false);
dump("\nTesting Content-Type: " + receivedHeader + " == " + headers[i].result + "\n");
Assert.equal(receivedHeader, headers[i].result);
--- a/mailnews/mime/test/unit/test_structured_headers.js
+++ b/mailnews/mime/test/unit/test_structured_headers.js
@@ -73,34 +73,34 @@ add_task(function* check_raw() {
Assert.ok(!headers.hasHeader("Date"));
let day = new Date("2000-01-01T00:00:00Z");
headers.setHeader("Date", day);
Assert.ok(headers.hasHeader("Date"));
Assert.ok(headers.hasHeader("date"));
Assert.equal(headers.getHeader("Date"), day);
Assert.equal(headers.getHeader("date"), day);
verifyError(() => headers.getUnstructuredHeader("Date"),
- Components.results.NS_ERROR_ILLEGAL_VALUE);
+ Cr.NS_ERROR_ILLEGAL_VALUE);
verifyError(() => headers.getAddressingHeader("Date"),
- Components.results.NS_ERROR_ILLEGAL_VALUE);
+ Cr.NS_ERROR_ILLEGAL_VALUE);
// This is easier than trying to match the actual value for the Date header,
// since that depends on the current timezone.
Assert.equal(new Date(headers.getRawHeader("Date")).getTime(), day.getTime());
// Otherwise, the string values should work.
headers.setRawHeader("Custom-Date", "1 Jan 2000 00:00:00 +0000", null);
Assert.equal(headers.getRawHeader("Custom-Date"), "1 Jan 2000 00:00:00 +0000");
headers.deleteHeader("Custom-Date");
headers.setUnstructuredHeader("Content-Description", "A description!");
Assert.equal(headers.getHeader("Content-Description"), "A description!");
Assert.equal(headers.getUnstructuredHeader("Content-Description"),
"A description!");
verifyError(() => headers.getAddressingHeader("Content-Description"),
- Components.results.NS_ERROR_ILLEGAL_VALUE);
+ Cr.NS_ERROR_ILLEGAL_VALUE);
Assert.equal(headers.getRawHeader("Content-Description"),
"A description!");
Assert.ok(!headers.hasHeader("Subject"));
Assert.ok(headers.getUnstructuredHeader("Subject") === null);
headers.setRawHeader("Subject", "=?UTF-8?B?56eB44Gv5Lu25ZCN5Y2I5YmN?=",
"US-ASCII");
Assert.equal(headers.getHeader("Subject"),
--- a/mailnews/news/content/downloadheaders.js
+++ b/mailnews/news/content/downloadheaders.js
@@ -12,25 +12,25 @@ var nntpServer = null;
var args = null;
function OnLoad()
{
let newsBundle = document.getElementById("bundle_news");
if ("arguments" in window && window.arguments[0]) {
args = window.arguments[0]
- .QueryInterface(Components.interfaces.nsINewsDownloadDialogArgs);
+ .QueryInterface(Ci.nsINewsDownloadDialogArgs);
/* by default, act like the user hit cancel */
args.hitOK = false;
/* by default, act like the user did not select download all */
args.downloadAll = false;
nntpServer = MailServices.accounts.getIncomingServer(args.serverKey)
- .QueryInterface(Components.interfaces.nsINntpIncomingServer);
+ .QueryInterface(Ci.nsINntpIncomingServer);
document.title = newsBundle.getString("downloadHeadersTitlePrefix");
let infotext = newsBundle.getFormattedString("downloadHeadersInfoText",
[args.articleCount]);
setText('info', infotext);
let okButtonText = newsBundle.getString("okButtonText");
let okbutton = document.documentElement.getButton("accept");
--- a/mailnews/news/test/unit/test_bug540288.js
+++ b/mailnews/news/test/unit/test_bug540288.js
@@ -63,17 +63,17 @@ function run_test() {
var uri = Services.io.newURI("news://localhost:" + server.port + "/TSS1%40nntp.test");
try {
// Add an empty message to the cache
MailServices.nntp
.cacheStorage
.asyncOpenURI(uri, "", Ci.nsICacheStorage.OPEN_NORMALLY, {
onCacheEntryAvailable: function(cacheEntry, isNew, appCache, status) {
- Assert.equal(status, Components.results.NS_OK);
+ Assert.equal(status, Cr.NS_OK);
cacheEntry.markValid();
// Get the folder and new mail
var folder = localserver.rootFolder.getChildNamed("test.subscribe.simple");
folder.clearFlag(Ci.nsMsgFolderFlags.Offline);
folder.getNewMessages(null, {
OnStopRunningUrl: function () { localserver.closeCachedConnections(); }});
--- a/mailnews/news/test/unit/test_internalUris.js
+++ b/mailnews/news/test/unit/test_internalUris.js
@@ -85,17 +85,17 @@ function* test_fetchMessage() {
statuscode = aStatus;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamListener,
Ci.nsIRequestObserver])
};
let folder = localserver.rootFolder.getChildNamed("test.filter");
MailServices.nntp.fetchMessage(folder, 2, null, streamlistener, asyncUrlListener);
yield false;
- Assert.equal(statuscode, Components.results.NS_OK);
+ Assert.equal(statuscode, Cr.NS_OK);
yield true;
}
function* test_search() {
// This tests nsNntpService::Search
let folder = localserver.rootFolder.getChildNamed("test.filter");
var searchSession = Cc["@mozilla.org/messenger/searchSession;1"]
.createInstance(Ci.nsIMsgSearchSession);
@@ -204,17 +204,17 @@ function* test_escapedName() {
onStopRequest: function (aRequest, aContext, aStatus) {
statuscode = aStatus;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamListener,
Ci.nsIRequestObserver])
};
MailServices.nntp.fetchMessage(folder, 1, null, streamlistener, asyncUrlListener);
yield false;
- Assert.equal(statuscode, Components.results.NS_OK);
+ Assert.equal(statuscode, Cr.NS_OK);
yield true;
}
function run_test() {
daemon = setupNNTPDaemon();
server = makeServer(NNTP_RFC2980_handler, daemon);
server.start();
localserver = setupLocalServer(server.port);
--- a/mailnews/news/test/unit/test_newsAutocomplete.js
+++ b/mailnews/news/test/unit/test_newsAutocomplete.js
@@ -6,17 +6,17 @@
*
* ***** END LICENSE BLOCK ***** */
ChromeUtils.import("resource:///modules/mailServices.js");
// The basic daemon to use for testing nntpd.js implementations
var gDaemon = setupNNTPDaemon();
-var ACR = Components.interfaces.nsIAutoCompleteResult;
+var ACR = Ci.nsIAutoCompleteResult;
function acObserver() {}
acObserver.prototype = {
_search: null,
_result: null,
onSearchResult: function (aSearch, aResult) {
@@ -27,18 +27,18 @@ acObserver.prototype = {
function run_test() {
let localserver = setupLocalServer(119);
// create identity
let identity = MailServices.accounts.createIdentity();
_account.addIdentity(identity);
- let acs = Components.classes["@mozilla.org/autocomplete/search;1?name=news"]
- .getService(Components.interfaces.nsIAutoCompleteSearch);
+ let acs = Cc["@mozilla.org/autocomplete/search;1?name=news"]
+ .getService(Ci.nsIAutoCompleteSearch);
let obs;
let paramsN = JSON.stringify({
idKey: identity.key,
accountKey: _account.key,
type: "addr_newsgroups" });
let paramsF = JSON.stringify({
idKey: identity.key,
--- a/mailnews/news/test/unit/test_nntpPassword2.js
+++ b/mailnews/news/test/unit/test_nntpPassword2.js
@@ -76,17 +76,17 @@ add_task(function *() {
// Now set up and run the tests
setupProtocolTest(server.port, prefix+"*", incomingServer);
server.performTest();
var transaction = server.playTransaction();
do_check_transaction(transaction, ["MODE READER", "LIST",
"AUTHINFO user testnews",
"AUTHINFO pass newstest", "LIST"]);
- incomingServer.QueryInterface(Components.interfaces.nsISubscribableServer)
+ incomingServer.QueryInterface(Ci.nsISubscribableServer)
.subscribeCleanup();
} catch (e) {
dump("NNTP Protocol test "+test+" failed for type RFC 977:\n");
try {
var trans = server.playTransaction();
if (trans)
dump("Commands called: "+trans.them+"\n");
--- a/mailnews/news/test/unit/test_nntpUrl.js
+++ b/mailnews/news/test/unit/test_nntpUrl.js
@@ -20,11 +20,11 @@ function run_test() {
// This is crash test for Bug 392729
try {
// msgkey is invalid for news:// protocol
let hdr = getMessageHeaderFromUrl("news://localhost:119" +
"/123@example.invalid?group=test.subscribe.simple&key=abcdefghijk");
Assert.ok(false);
} catch (e) {
- Assert.equal(e.result, Components.results.NS_ERROR_MALFORMED_URI);
+ Assert.equal(e.result, Cr.NS_ERROR_MALFORMED_URI);
}
}
--- a/mailnews/news/test/unit/test_uriParser.js
+++ b/mailnews/news/test/unit/test_uriParser.js
@@ -137,17 +137,17 @@ var invalid_uris = [
"nntp://localhost/a.group/0",
"nntp:a.group"
];
function run_test() {
// We're not running the server, just setting it up
localserver = setupLocalServer(119);
let nntpService = Cc["@mozilla.org/messenger/nntpservice;1"]
- .getService(Components.interfaces.nsIProtocolHandler);
+ .getService(Ci.nsIProtocolHandler);
for (let test of tests) {
dump("Checking URL " + test.uri + "\n");
let url = nntpService.newURI(test.uri);
url.QueryInterface(Ci.nsIMsgMailNewsUrl);
url.QueryInterface(Ci.nsINntpUrl);
for (let prop in test) {
if (prop == "uri")
continue;
@@ -156,17 +156,17 @@ function run_test() {
}
for (let fail of invalid_uris) {
try {
dump("Checking URL " + fail + " for failure\n");
nntpService.newURI(fail);
Assert.ok(false);
} catch (e) {
- Assert.equal(e.result, Components.results.NS_ERROR_MALFORMED_URI);
+ Assert.equal(e.result, Cr.NS_ERROR_MALFORMED_URI);
}
}
// The password migration is async, so trigger an event to prevent the logon
// manager from trying to migrate after shutdown has started.
let thread = Services.tm.currentThread;
while (thread.hasPendingEvents())
thread.processNextEvent(true);
--- a/mailnews/test/resources/POP3pump.js
+++ b/mailnews/test/resources/POP3pump.js
@@ -41,29 +41,29 @@ function POP3Pump()
this.kPOP3_PORT = 1024 + 110;
this._server = null;
this._daemon = null;
this._incomingServer = null;
this._pop3Service = null;
this._firstFile = true;
this._tests = [];
this._finalCleanup = false;
- this._expectedResult = Components.results.NS_OK;
- this._actualResult = Components.results.NS_ERROR_UNEXPECTED;
+ this._expectedResult = Cr.NS_OK;
+ this._actualResult = Cr.NS_ERROR_UNEXPECTED;
this._mailboxStoreContractID =
Services.prefs.getCharPref("mail.serverDefaultStoreContractID");
}
// nsIUrlListener implementation
POP3Pump.prototype.OnStartRunningUrl = function OnStartRunningUrl(url) {};
POP3Pump.prototype.OnStopRunningUrl = function OnStopRunningUrl(aUrl, aResult)
{
this._actualResult = aResult;
- if (aResult != Components.results.NS_OK)
+ if (aResult != Cr.NS_OK)
{
// If we have an error, clean up nicely.
this._server.stop();
var thread = Services.tm.currentThread;
while (thread.hasPendingEvents())
thread.processNextEvent(true);
}
@@ -141,17 +141,17 @@ POP3Pump.prototype._checkBusy = function
if (Services.tm.currentThread.hasPendingEvents())
do_timeout(20, _checkPumpBusy);
else
{
// exit this module
do_test_finished();
if (this.onDone)
this._promise.then(this.onDone, this.onDone);
- if (this._actualResult == Components.results.NS_OK)
+ if (this._actualResult == Cr.NS_OK)
this._resolve();
else
this._reject(this._actualResult);
}
return;
}
// If the server hasn't quite finished, just delay a little longer.
--- a/mailnews/test/resources/alertTestUtils.js
+++ b/mailnews/test/resources/alertTestUtils.js
@@ -225,17 +225,17 @@ var alertUtilsPromptService = {
}
do_throw("selectPS unexpectedly called: " + aText + "\n");
return false;
},
createInstance: function createInstance(outer, iid) {
if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid);
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIPromptService,
Ci.nsIPromptService2])
};
var alertUtilsWindowWatcher = {
--- a/mailnews/test/resources/folderEventLogHelper.js
+++ b/mailnews/test/resources/folderEventLogHelper.js
@@ -44,42 +44,42 @@ var _folderEventLogHelper_msgFolderListe
},
msgsClassified: function felh_msgsClassified(aMsgs, aJunkProcessed,
aTraitProcessed) {
let args = [
aJunkProcessed ? "junk processed" : "did not junk process",
aTraitProcessed ? "trait processed" : "did not trait process"
];
- for (let msgHdr of fixIterator(aMsgs, Components.interfaces.nsIMsgDBHdr)) {
+ for (let msgHdr of fixIterator(aMsgs, Ci.nsIMsgDBHdr)) {
args.push(msgHdr);
}
mark_action("msgEvent", "msgsClassified", args);
},
msgsDeleted: function felh_msgsDeleted(aMsgs) {
let args = [];
- for (let msgHdr of fixIterator(aMsgs, Components.interfaces.nsIMsgDBHdr)) {
+ for (let msgHdr of fixIterator(aMsgs, Ci.nsIMsgDBHdr)) {
args.push(msgHdr);
}
mark_action("msgEvent", "msgsDeleted", args);
},
msgsMoveCopyCompleted: function felh_msgsMoveCopyCompleted(aMove, aSrcMsgs,
aDestFolder,
aDestMsgs) {
let args = [aMove ? "moved" : "copied"];
- for (let msgHdr of fixIterator(aSrcMsgs, Components.interfaces.nsIMsgDBHdr)) {
+ for (let msgHdr of fixIterator(aSrcMsgs, Ci.nsIMsgDBHdr)) {
args.push(msgHdr);
}
args.push("to");
args.push(aDestFolder);
if (aDestMsgs) {
args.push("dest headers:");
- for (let msgHdr of fixIterator(aDestMsgs, Components.interfaces.nsIMsgDBHdr)) {
+ for (let msgHdr of fixIterator(aDestMsgs, Ci.nsIMsgDBHdr)) {
args.push(msgHdr);
}
}
mark_action("msgEvent", "msgsMoveCopyCompleted", args);
},
msgKeyChanged: function felh_msgKeyChanged(aOldMsgKey, aNewMsgHdr) {
let args = ["old key", aOldMsgKey, "new header", aNewMsgHdr];
@@ -138,17 +138,17 @@ var _folderEventLogHelper_folderListener
*/
OnItemPropertyFlagChanged: function felh_OnItemPropertyFlagChanged(
aMsgHdr, aProperty, aOldValue, aNewValue) {
mark_action("msgEvent", "OnItemPropertyFlagChanged",
["Header", aMsgHdr,
"had property " + aProperty + " have the " +
"following bits change: " +
_explode_flags(aOldValue ^ aNewValue,
- Components.interfaces.nsMsgMessageFlags)]);
+ Ci.nsMsgMessageFlags)]);
},
/**
* Get folder loaded notifications for folders that had to do some
* (asynchronous) processing before they could be opened.
*/
OnItemEvent: function felh_OnItemEvent(aFolder, aEvent) {
mark_action("msgEvent", "OnItemEvent",
--- a/mailnews/test/resources/logHelper.js
+++ b/mailnews/test/resources/logHelper.js
@@ -17,17 +17,17 @@ var _xpcshellLogger;
var _testLoggerContexts = [];
var _testLoggerActiveContext;
var _logHelperInterestedListeners = false;
/**
* Let test code extend the list of allowed XPCOM errors.
*/
-var logHelperAllowedErrors = [Components.results.NS_ERROR_FAILURE];
+var logHelperAllowedErrors = [Cr.NS_ERROR_FAILURE];
/**
* Let other test helping code decide whether to register for potentially
* expensive notifications based on whether anyone can even hear those
* results.
*/
function logHelperHasInterestedListeners() {
return _logHelperInterestedListeners;
@@ -58,30 +58,30 @@ var _errorConsoleTunnel = {
if (aTopic == "quit-application") {
this.shutdown();
return;
}
try {
// meh, let's just use mark_failure for now.
// and let's avoid feedback loops (happens in mozmill)
- if ((aMessage instanceof Components.interfaces.nsIScriptError) &&
+ if ((aMessage instanceof Ci.nsIScriptError) &&
(!aMessage.errorMessage.includes("Error console says")))
{
// Unfortunately changes to mozilla-central are throwing lots
// of console errors during testing, so disable (we hope temporarily)
// failing on XPCOM console errors (see bug 1014350).
// An XPCOM error aMessage looks like this:
// [JavaScript Error: "uncaught exception: 2147500037"]
// Capture the number, and allow known XPCOM results.
let matches = /exception: (\d+)/.exec(aMessage);
let XPCOMresult = null;
if (matches) {
for (let result in Components.results) {
- if (matches[1] == Components.results[result])
+ if (matches[1] == Cr[result])
{
XPCOMresult = result;
break;
}
}
let message = XPCOMresult || aMessage;
if (logHelperAllowedErrors.some(e => e == matches[1]))
{
--- a/mailnews/test/resources/mailShutdown.js
+++ b/mailnews/test/resources/mailShutdown.js
@@ -7,17 +7,17 @@
// it will mimic the behaviour in the app sufficiently.
//
// See also http://developer.mozilla.org/en/Observer_Notifications
function postShutdownNotifications()
{
// first give everyone a heads up about us shutting down. if someone wants
// to cancel this, our test should fail.
var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
+ .createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested");
if (cancelQuit.data) {
do_throw("Cannot shutdown: Someone cancelled the quit request!");
}
// post all notifications in the right order. none of these are cancellable
var notifications = ["quit-application",
"profile-change-net-teardown",
--- a/mailnews/test/resources/mailTestUtils.js
+++ b/mailnews/test/resources/mailTestUtils.js
@@ -408,30 +408,30 @@ var mailTestUtils = {
*
* @param aDelayInMS The number of milliseconds to wait before firing the timer.
* @param aFunc The function to invoke when the timer fires.
* @param aFuncThis Optional 'this' pointer to use.
* @param aFuncArgs Optional list of arguments to pass to the function.
*/
_timer: null,
do_timeout_function: function(aDelayInMS, aFunc, aFuncThis, aFuncArgs) {
- this._timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ this._timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
let wrappedFunc = function() {
try {
aFunc.apply(aFuncThis, aFuncArgs);
}
catch (ex) {
// we want to make sure that if the thing we call throws an exception,
// that this terminates the test.
do_throw(ex);
}
};
this._timer.initWithCallback(wrappedFunc, aDelayInMS,
- Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ Ci.nsITimer.TYPE_ONE_SHOT);
},
/**
* Ensure the given nsIMsgFolder's database is up-to-date, calling the provided
* callback once the folder has been loaded. (This may be instantly or
* after a re-parse.)
*
* @param aFolder The nsIMsgFolder whose database you want to ensure is
@@ -488,17 +488,17 @@ var mailTestUtils = {
// It will simply return the current directory.
const provider = {
getFile : function(prop, persistent) {
if (prop == "UMimTyp") {
var mimeTypes = Services.dirsvc.get("ProfD", Ci.nsIFile);
mimeTypes.append("mimeTypes.rdf");
return mimeTypes;
}
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
},
QueryInterface:
XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider])
};
this._providerSvc = provider;
Services.dirsvc.QueryInterface(Ci.nsIDirectoryService)
--- a/mailnews/test/resources/messageInjection.js
+++ b/mailnews/test/resources/messageInjection.js
@@ -251,28 +251,28 @@ function register_message_injection_list
*/
function _synthMessagesToFakeRep(aSynthMessages) {
return aSynthMessages.
map(msg => ({fileData: msg.toMessageString(), size: -1}));
}
var SEARCH_TERM_MAP_HELPER = {
- subject: Components.interfaces.nsMsgSearchAttrib.Subject,
- body: Components.interfaces.nsMsgSearchAttrib.Body,
- from: Components.interfaces.nsMsgSearchAttrib.Sender,
- to: Components.interfaces.nsMsgSearchAttrib.To,
- cc: Components.interfaces.nsMsgSearchAttrib.CC,
- recipient: Components.interfaces.nsMsgSearchAttrib.ToOrCC,
- involves: Components.interfaces.nsMsgSearchAttrib.AllAddresses,
- age: Components.interfaces.nsMsgSearchAttrib.AgeInDays,
- tags: Components.interfaces.nsMsgSearchAttrib.Keywords,
+ subject: Ci.nsMsgSearchAttrib.Subject,
+ body: Ci.nsMsgSearchAttrib.Body,
+ from: Ci.nsMsgSearchAttrib.Sender,
+ to: Ci.nsMsgSearchAttrib.To,
+ cc: Ci.nsMsgSearchAttrib.CC,
+ recipient: Ci.nsMsgSearchAttrib.ToOrCC,
+ involves: Ci.nsMsgSearchAttrib.AllAddresses,
+ age: Ci.nsMsgSearchAttrib.AgeInDays,
+ tags: Ci.nsMsgSearchAttrib.Keywords,
// If a test uses a custom search term, they must register that term
// with the id "mailnews@mozilla.org#test"
- custom: Components.interfaces.nsMsgSearchAttrib.Custom,
+ custom: Ci.nsMsgSearchAttrib.Custom,
};
/**
* Create and return an empty folder. If you want to delete this folder
* you must call |delete_folder| to kill it! If you want to rename it, you
* must implement a method called rename_folder and then call it.
*
* @param [aFolderName] A folder name with no support for hierarchy at this
@@ -421,28 +421,28 @@ function make_virtual_folder(aFolders, a
let name = aName ? aName : "virt" + mis._nextUniqueFolderId++;
mark_action("messageInjection", "make_virtual_folder",
["creating folder named", name,
"from folders", aFolders, "anding?", aBooleanAnd,
"using search def", aSearchDef]);
let terms = [];
- let termCreator = Components.classes["@mozilla.org/messenger/searchSession;1"]
- .createInstance(Ci.nsIMsgSearchSession);
+ let termCreator = Cc["@mozilla.org/messenger/searchSession;1"]
+ .createInstance(Ci.nsIMsgSearchSession);
for (let key in aSearchDef) {
let val = aSearchDef[key];
let term = termCreator.createTerm();
let value = term.value;
value.str = val;
term.value = value;
term.attrib = SEARCH_TERM_MAP_HELPER[key];
- if (term.attrib == Components.interfaces.nsMsgSearchAttrib.Custom)
+ if (term.attrib == Ci.nsMsgSearchAttrib.Custom)
term.customId = "mailnews@mozilla.org#test";
- term.op = Components.interfaces.nsMsgSearchOp.Contains;
+ term.op = Ci.nsMsgSearchOp.Contains;
term.booleanAnd = Boolean(aBooleanAnd);
terms.push(term);
}
// create an ALL case if we didn't add any terms
if (terms.length == 0) {
let term = termCreator.createTerm();
term.matchAll = true;
terms.push(term);
@@ -623,17 +623,17 @@ function add_sets_to_folders(aMsgFolders
let iterFolders, folderList;
let popMessages, msgHdrs;
_messageInjectionSetup.notifyListeners("onInjectingMessages", []);
// -- Pre-loop
if (mis.injectionConfig.mode == "local") {
for (let folder of aMsgFolders) {
- if (!(folder instanceof Components.interfaces.nsIMsgLocalMailFolder))
+ if (!(folder instanceof Ci.nsIMsgLocalMailFolder))
throw new Exception("All folders in aMsgFolders must be local folders!");
}
folderList = aMsgFolders;
}
else if (mis.injectionConfig.mode == "imap") {
// no protection is possible because of our dependency on promises,
// although we could check that the fake URL is one we handed out.
folderList = aMsgFolders;
--- a/mailnews/test/resources/messageModifier.js
+++ b/mailnews/test/resources/messageModifier.js
@@ -141,17 +141,17 @@ SyntheticMessageSet.prototype = {
return Array.from(this.msgHdrs());
},
/**
* @return an nsIMutableArray of the message headers for all messages inserted
* into a folder.
*/
get xpcomHdrArray() {
return toXPCOMArray(this.msgHdrs(),
- Components.interfaces.nsIMutableArray);
+ Ci.nsIMutableArray);
},
/**
* @return a list where each item is a list with two elements; the first is
* an nsIMsgFolder, and the second is a list of all of the nsIMsgDBHdrs
* for the synthetic messages in the set inserted into that folder.
*/
get foldersWithMsgHdrs() {
let results = this.msgFolders.map(folder => [folder, []]);
@@ -166,17 +166,17 @@ SyntheticMessageSet.prototype = {
},
/**
* @return a generator that yields [nsIMsgFolder, nsIMutableArray of the
* messages from the set in that folder].
*/
foldersWithXpcomHdrArrays: function*() {
for (let [folder, msgHdrs] of this.foldersWithMsgHdrs) {
yield [folder, toXPCOMArray(msgHdrs,
- Components.interfaces.nsIMutableArray)];
+ Ci.nsIMutableArray)];
}
},
/**
* Sets the status of the messages to read/unread.
*
* @param aRead true/false to set messages as read/unread
* @param aMsgHdr A message header to work on. If not specified,
* mark all messages in the current set.
--- a/suite/browser/browser.js
+++ b/suite/browser/browser.js
@@ -1,14 +1,14 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
+const nsIWebNavigation = Ci.nsIWebNavigation;
var gPrintSettingsAreGlobal = true;
var gSavePrintSettings = true;
var gChromeState = null; // chrome state before we went into print preview
var gInPrintPreviewMode = false;
var gNavToolbox = null;
function getWebNavigation()
{
@@ -26,17 +26,17 @@ function BrowserReloadWithFlags(reloadFl
* window (such as view-source) that has no session history, fall
* back on using the web navigation's reload method.
*/
var webNav = getWebNavigation();
try {
var sh = webNav.sessionHistory;
if (sh)
- webNav = sh.QueryInterface(Components.interfaces.nsIWebNavigation);
+ webNav = sh.QueryInterface(Ci.nsIWebNavigation);
} catch (e) {
}
try {
webNav.reload(reloadFlags);
} catch (e) {
}
}
--- a/suite/browser/linkToolbarOverlay.js
+++ b/suite/browser/linkToolbarOverlay.js
@@ -51,33 +51,33 @@ function(event)
linkToolbarUI.deactivate();
linkToolbarUI.fullSlowRefresh();
}
LinkToolbarUI.prototype.fullSlowRefresh =
function()
{
var currentNode = getBrowser().contentDocument.documentElement;
- if (!(currentNode instanceof Components.interfaces.nsIDOMHTMLHtmlElement))
+ if (!(currentNode instanceof Ci.nsIDOMHTMLHtmlElement))
return;
currentNode = currentNode.firstChild;
while(currentNode)
{
- if (currentNode instanceof Components.interfaces.nsIDOMHTMLHeadElement) {
+ if (currentNode instanceof Ci.nsIDOMHTMLHeadElement) {
currentNode = currentNode.firstChild;
while(currentNode)
{
if (ChromeUtils.getClassName(currentNode) === "HTMLLinkElement")
linkToolbarUI.linkAdded({originalTarget: currentNode});
currentNode = currentNode.nextSibling;
}
}
- else if (currentNode instanceof Components.interfaces.nsIDOMElement)
+ else if (currentNode instanceof Ci.nsIDOMElement)
{
// head is supposed to be the first element inside html.
// Got something else instead. returning
return;
}
else
{
// Got a comment node or something like that. Moving on.
@@ -131,17 +131,17 @@ function(event)
if (!event.target.getAttribute("href")) return;
var destURL = event.target.getAttribute("href");
// We have to do a security check here, because we are loading URIs given
// to us by a web page from chrome, which is privileged.
try {
urlSecurityCheck(destURL, content.document.nodePrincipal,
- Components.interfaces.nsIScriptSecurityManager.STANDARD);
+ Ci.nsIScriptSecurityManager.STANDARD);
loadURI(destURL, content.document.documentURIObject);
} catch (e) {
dump("Error: it is not permitted to load this URI from a <link> element: " + e);
}
}
// functions for twiddling XUL elements in the toolbar
--- a/suite/browser/mailNavigatorOverlay.js
+++ b/suite/browser/mailNavigatorOverlay.js
@@ -11,39 +11,39 @@ var gUseExternalMailto;
function openComposeWindow(url, title, attachment, charset)
{
if (gUseExternalMailto)
{
openExternalMailer(url, title);
}
else
{
- var params = Components.classes["@mozilla.org/messengercompose/composeparams;1"]
- .createInstance(Components.interfaces.nsIMsgComposeParams);
+ var params = Cc["@mozilla.org/messengercompose/composeparams;1"]
+ .createInstance(Ci.nsIMsgComposeParams);
- params.composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
- .createInstance(Components.interfaces.nsIMsgCompFields);
+ params.composeFields = Cc["@mozilla.org/messengercompose/composefields;1"]
+ .createInstance(Ci.nsIMsgCompFields);
if (attachment == 0 || attachment == 1)
{
params.composeFields.body = url;
params.composeFields.subject = title;
params.bodyIsLink = true;
}
if (attachment == 1 || attachment == 2)
{
- var attachmentData = Components.classes["@mozilla.org/messengercompose/attachment;1"]
- .createInstance(Components.interfaces.nsIMsgAttachment);
+ var attachmentData = Cc["@mozilla.org/messengercompose/attachment;1"]
+ .createInstance(Ci.nsIMsgAttachment);
attachmentData.url = url;
attachmentData.urlCharset = charset;
params.composeFields.addAttachment(attachmentData);
}
- var composeService = Components.classes["@mozilla.org/messengercompose;1"]
- .getService(Components.interfaces.nsIMsgComposeService);
+ var composeService = Cc["@mozilla.org/messengercompose;1"]
+ .getService(Ci.nsIMsgComposeService);
// it is possible you won't have a default identity
// like if you've never launched mail before on a new profile.
// see bug #196073
try
{
params.identity = composeService.defaultIdentity;
}
@@ -52,18 +52,18 @@ function openComposeWindow(url, title, a
params.identity = null;
}
composeService.OpenComposeWindowWithParams(null, params);
}
}
function openExternalMailer(url, title) {
- var extProtocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ var extProtocolSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
var mailto = url ? "mailto:?body=" + encodeURIComponent(url)
+ "&subject="
+ encodeURIComponent(title) : "mailto:";
var uri = Services.io.newURI(mailto);
extProtocolSvc.loadURI(uri);
}
@@ -80,21 +80,21 @@ function goOpenNewMessage()
openExternalMailer();
}
else if ("MsgNewMessage" in window)
{
MsgNewMessage(null);
}
else
{
- var msgComposeService = Components.classes["@mozilla.org/messengercompose;1"]
- .getService(Components.interfaces.nsIMsgComposeService);
+ var msgComposeService = Cc["@mozilla.org/messengercompose;1"]
+ .getService(Ci.nsIMsgComposeService);
msgComposeService.OpenComposeWindow(null, null, null,
- Components.interfaces.nsIMsgCompType.New,
- Components.interfaces.nsIMsgCompFormat.Default,
+ Ci.nsIMsgCompType.New,
+ Ci.nsIMsgCompFormat.Default,
null, null);
}
}
function sendLink(aURL)
{
var title = "";
if (!aURL)
@@ -163,14 +163,14 @@ function hideMenuitems() {
document.getElementById("menu_newCard").hidden = gUseExternalMailto;
var menu_sendPage = document.getElementById("menu_sendPage");
if (menu_sendPage)
menu_sendPage.hidden = gUseExternalMailto;
}
function initOverlay(aEvent) {
gUseExternalMailto = Services.io.getProtocolHandler("mailto") instanceof
- Components.interfaces.nsIExternalProtocolHandler;
+ Ci.nsIExternalProtocolHandler;
initMailContextMenuPopupListener(aEvent);
hideMenuitems();
}
addEventListener("load", initOverlay, false);
--- a/suite/browser/metadata.js
+++ b/suite/browser/metadata.js
@@ -19,17 +19,17 @@ var onLink = false;
var onImage = false;
var onInsDel = false;
var onQuote = false;
var onMisc = false;
var onTable = false;
var onTitle = false;
var onLang = false;
-const OPEN_READONLY = Components.interfaces.nsICacheStorage.OPEN_READONLY;
+const OPEN_READONLY = Ci.nsICacheStorage.OPEN_READONLY;
function onLoad()
{
gMetadataBundle = document.getElementById("bundle_metadata");
gLangBundle = document.getElementById("bundle_languages");
gRegionBundle = document.getElementById("bundle_regions");
showMetadataFor(window.arguments[0]);
@@ -109,17 +109,17 @@ var cacheListener = {
setInfo("image-filesize", gMetadataBundle.getFormattedString("imageSize",
[formatNumber(kbSize),
formatNumber(descriptor.dataSize)]));
} else {
setInfo("image-filesize", gMetadataBundle.getString("imageSizeUnknown"));
}
},
onCacheEntryCheck: function onCacheEntryCheck() {
- return Components.interfaces.nsICacheEntryOpenCallback.ENTRY_WANTED;
+ return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED;
}
};
function checkForImage(elem, htmllocalname)
{
var img;
var imgType; // "img" = <img>
// "object" = <object>
@@ -162,25 +162,25 @@ function checkForImage(elem, htmllocalna
}
if (img) {
var imgURL = imgType == "object" ? img.data : img.src;
setInfo("image-url", imgURL);
- const LoadContextInfo = Components.classes["@mozilla.org/load-context-info-factory;1"]
- .getService(Components.interfaces.nsILoadContextInfoFactory);
+ const LoadContextInfo = Cc["@mozilla.org/load-context-info-factory;1"]
+ .getService(Ci.nsILoadContextInfoFactory);
var loadContextInfo = opener.gPrivate ? LoadContextInfo.private :
LoadContextInfo.default;
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
- Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
- .getService(Components.interfaces.nsICacheStorageService)
- .diskCacheStorage(loadContextInfo, false)
- .asyncOpenURI(NetUtil.newURI(imgURL), null,
+ Cc["@mozilla.org/netwerk/cache-storage-service;1"]
+ .getService(Ci.nsICacheStorageService)
+ .diskCacheStorage(loadContextInfo, false)
+ .asyncOpenURI(NetUtil.newURI(imgURL), null,
OPEN_READONLY, cacheListener);
if ("width" in img && img.width != "") {
setInfo("image-width", gMetadataBundle.getFormattedString("imageWidth", [formatNumber(img.width)]));
setInfo("image-height", gMetadataBundle.getFormattedString("imageHeight", [formatNumber(img.height)]));
}
else {
setInfo("image-width", "");
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -105,18 +105,18 @@ const gPopupPermListener = {
if (closeURI.host == popupOpenerURI.host)
window.close();
}
}
}
};
const gFormSubmitObserver = {
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIFormSubmitObserver,
- Components.interfaces.nsIObserver]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIFormSubmitObserver,
+ Ci.nsIObserver]),
panel: null,
init: function()
{
this.panel = document.getElementById("invalid-form-popup");
},
@@ -129,17 +129,17 @@ const gFormSubmitObserver = {
return;
}
// Don't show the popup if the current tab doesn't contain the invalid form.
if (aFormElement.ownerDocument.defaultView.top != content) {
return;
}
- let element = aInvalidElements.queryElementAt(0, Components.interfaces.nsISupports);
+ let element = aInvalidElements.queryElementAt(0, Ci.nsISupports);
if (!(element instanceof HTMLInputElement ||
element instanceof HTMLTextAreaElement ||
element instanceof HTMLSelectElement ||
element instanceof HTMLButtonElement)) {
return;
}
@@ -175,18 +175,18 @@ const gFormSubmitObserver = {
element.removeEventListener("input", inputHandler);
element.removeEventListener("blur", blurHandler);
});
this.panel.hidden = false;
var win = element.ownerDocument.defaultView;
var style = win.getComputedStyle(element, null);
- var scale = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindowUtils)
+ var scale = win.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils)
.fullZoom;
var offset = style.direction == 'rtl' ? parseInt(style.paddingRight) +
parseInt(style.borderRightWidth) :
parseInt(style.paddingLeft) +
parseInt(style.borderLeftWidth);
offset = Math.round(offset * scale);
@@ -334,71 +334,71 @@ function UpdateBackForwardButtons()
if (upDisabled != !browser.currentURI.spec.replace(/[#?].*$/, "").match(/\/[^\/]+\/./)) {
if (upDisabled)
upBroadcaster.removeAttribute("disabled");
else
upBroadcaster.setAttribute("disabled", true);
}
}
-const nsIBrowserDOMWindow = Components.interfaces.nsIBrowserDOMWindow;
-const nsIInterfaceRequestor = Components.interfaces.nsIInterfaceRequestor;
+const nsIBrowserDOMWindow = Ci.nsIBrowserDOMWindow;
+const nsIInterfaceRequestor = Ci.nsIInterfaceRequestor;
function nsBrowserAccess() {
}
nsBrowserAccess.prototype = {
createContentWindow(aURI, aOpener, aWhere, aFlags, aTriggeringPrincipal = null) {
return this.getContentWindowOrOpenURI(null, aOpener, aWhere, aFlags,
aTriggeringPrincipal);
},
openURI: function (aURI, aOpener, aWhere, aFlags, aTriggeringPrincipal = null) {
if (!aURI) {
- Components.utils.reportError("openURI should only be called with a valid URI");
- throw Components.results.NS_ERROR_FAILURE;
+ Cu.reportError("openURI should only be called with a valid URI");
+ throw Cr.NS_ERROR_FAILURE;
}
return this.getContentWindowOrOpenURI(aURI, aOpener, aWhere, aFlags,
aTriggeringPrincipal);
},
getContentWindowOrOpenURI(aURI, aOpener, aWhere, aFlags, aTriggeringPrincipal) {
var isExternal = !!(aFlags & nsIBrowserDOMWindow.OPEN_EXTERNAL);
if (aOpener && isExternal) {
- Components.utils.reportError("nsBrowserAccess.openURI did not expect an opener to be " +
- "passed if the context is OPEN_EXTERNAL.");
- throw Components.results.NS_ERROR_FAILURE;
+ Cu.reportError("nsBrowserAccess.openURI did not expect an opener to be " +
+ "passed if the context is OPEN_EXTERNAL.");
+ throw Cr.NS_ERROR_FAILURE;
}
if (aWhere == nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW) {
if (isExternal)
aWhere = Services.prefs.getIntPref("browser.link.open_external");
else
aWhere = Services.prefs.getIntPref("browser.link.open_newwindow");
}
let referrer = aOpener ? aOpener.QueryInterface(nsIInterfaceRequestor)
.getInterface(nsIWebNavigation)
.currentURI : null;
- let referrerPolicy = Components.interfaces.nsIHttpChannel.REFERRER_POLICY_UNSET;
+ let referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_UNSET;
var uri = aURI ? aURI.spec : "about:blank";
switch (aWhere) {
case nsIBrowserDOMWindow.OPEN_NEWWINDOW:
return window.openDialog(getBrowserURL(), "_blank", "all,dialog=no",
uri, null, null);
case nsIBrowserDOMWindow.OPEN_NEWTAB:
var bgLoad = Services.prefs.getBoolPref("browser.tabs.loadDivertedInBackground");
var isRelated = referrer ? true : false;
// If we have an opener, that means that the caller is expecting access
// to the nsIDOMWindow of the opened tab right away.
let userContextId = aOpener && aOpener.document
? aOpener.document.nodePrincipal.originAttributes.userContextId
- : Components.interfaces.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID;
+ : Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID;
let openerWindow = (aFlags & nsIBrowserDOMWindow.OPEN_NO_OPENER) ? null : aOpener;
var newTab = gBrowser.loadOneTab(uri, {triggeringPrincipal: aTriggeringPrincipal,
referrerURI: referrer,
referrerPolicy,
inBackground: bgLoad,
fromExternal: isExternal,
relatedToCurrent: isRelated,
@@ -503,51 +503,51 @@ function Startup()
// Do all UI building here:
UpdateNavBar();
updateWindowState();
// set home button tooltip text
updateHomeButtonTooltip();
- var lc = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsILoadContext);
+ var lc = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsILoadContext);
if (lc.usePrivateBrowsing) {
gPrivate = window;
document.documentElement.removeAttribute("windowtype");
var titlemodifier = document.documentElement.getAttribute("titlemodifier");
if (titlemodifier)
titlemodifier += " ";
titlemodifier += document.documentElement.getAttribute("titleprivate");
document.documentElement.setAttribute("titlemodifier", titlemodifier);
document.title = titlemodifier;
}
// initialize observers and listeners
- var xw = lc.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+ var xw = lc.QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIXULWindow);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIXULWindow);
xw.XULBrowserWindow = window.XULBrowserWindow = new nsBrowserStatusHandler();
if (!window.content.opener &&
Services.prefs.getBoolPref("browser.doorhanger.enabled")) {
var tmp = {};
ChromeUtils.import("resource://gre/modules/PopupNotifications.jsm", tmp);
window.PopupNotifications = new tmp.PopupNotifications(
getBrowser(),
document.getElementById("notification-popup"),
document.getElementById("notification-popup-box"));
// Setting the popup notification attribute causes the XBL to bind
// and call the constructor again, so we have to destroy it first.
gBrowser.getNotificationBox().destroy();
gBrowser.setAttribute("popupnotification", "true");
// The rebind also resets popup window scrollbar visibility, so override it.
- if (!(xw.chromeFlags & Components.interfaces.nsIWebBrowserChrome.CHROME_SCROLLBARS))
+ if (!(xw.chromeFlags & Ci.nsIWebBrowserChrome.CHROME_SCROLLBARS))
gBrowser.selectedBrowser.style.overflow = "hidden";
}
addPrefListener(gTabStripPrefListener);
addPrefListener(gHomepagePrefListener);
addPrefListener(gStatusBarPopupIconPrefListener);
addPopupPermListener(gPopupPermListener);
addFormSubmitObserver(gFormSubmitObserver);
@@ -654,20 +654,20 @@ function Startup()
if (typeof(referrerURI) == "string") {
try {
referrerURI = makeURI(referrerURI);
} catch (e) {
referrerURI = null;
}
}
let referrerPolicy = (window.arguments[5] != undefined ?
- window.arguments[5] : Components.interfaces.nsIHttpChannel.REFERRER_POLICY_UNSET);
+ window.arguments[5] : Ci.nsIHttpChannel.REFERRER_POLICY_UNSET);
let userContextId = (window.arguments[6] != undefined ?
- window.arguments[6] : Components.interfaces.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID);
+ window.arguments[6] : Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID);
try {
openLinkIn(uriToLoad, "current",
{ referrerURI,
referrerPolicy,
postData: window.arguments[3] || null,
allowThirdPartyFixup: window.arguments[4] || false,
userContextId,
@@ -699,23 +699,23 @@ function Startup()
setTimeout(WindowFocusTimerCallback, 0, content);
// hook up browser access support
window.browserDOMWindow = new nsBrowserAccess();
// hook up remote support
if (!gPrivate && REMOTESERVICE_CONTRACTID in Components.classes) {
var remoteService =
- Components.classes[REMOTESERVICE_CONTRACTID]
- .getService(Components.interfaces.nsIRemoteService);
+ Cc[REMOTESERVICE_CONTRACTID]
+ .getService(Ci.nsIRemoteService);
remoteService.registerWindow(window);
}
// ensure login manager is loaded
- Components.classes["@mozilla.org/login-manager;1"].getService();
+ Cc["@mozilla.org/login-manager;1"].getService();
// called when we go into full screen, even if it is
// initiated by a web page script
addEventListener("fullscreen", onFullScreen, true);
addEventListener("PopupCountChanged", UpdateStatusBarPopupIcon, true);
addEventListener("AppCommand", HandleAppCommandEvent, true);
@@ -826,18 +826,18 @@ function updateWindowState()
!isElementVisible(document.getElementById("status-bar"));
getBrowser().docShellIsActive =
window.windowState != window.STATE_MINIMIZED;
}
function InitSessionStoreCallback()
{
try {
- var ss = Components.classes["@mozilla.org/suite/sessionstore;1"]
- .getService(Components.interfaces.nsISessionStore);
+ var ss = Cc["@mozilla.org/suite/sessionstore;1"]
+ .getService(Ci.nsISessionStore);
ss.init(window);
//Check if we have "Deferred Session Restore"
let restoreItem = document.getElementById("historyRestoreLastSession");
if (ss.canRestoreLastSession)
restoreItem.removeAttribute("disabled");
} catch(ex) {
@@ -850,20 +850,20 @@ function WindowFocusTimerCallback(elemen
// This function is a redo of the fix for jag bug 91884.
// See Bug 97067 and Bug 89214 for details.
if (window == Services.ww.activeWindow) {
element.focus();
} else {
// set the element in command dispatcher so focus will restore properly
// when the window does become active
- if (element instanceof Components.interfaces.nsIDOMWindow) {
+ if (element instanceof Ci.nsIDOMWindow) {
document.commandDispatcher.focusedWindow = element;
document.commandDispatcher.focusedElement = null;
- } else if (element instanceof Components.interfaces.nsIDOMElement) {
+ } else if (element instanceof Ci.nsIDOMElement) {
document.commandDispatcher.focusedWindow = element.ownerDocument.defaultView;
document.commandDispatcher.focusedElement = element;
}
}
}
function Shutdown()
{
@@ -879,21 +879,21 @@ function Shutdown()
try {
getBrowser().removeProgressListener(window.XULBrowserWindow);
} catch (ex) {
// Perhaps we didn't get around to adding the progress listener
}
window.XULBrowserWindow.destroy();
window.XULBrowserWindow = null;
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem).treeOwner
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIXULWindow)
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem).treeOwner
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIXULWindow)
.XULBrowserWindow = null;
// unregister us as a pref listener
removePrefListener(gTabStripPrefListener);
removePrefListener(gHomepagePrefListener);
removePrefListener(gStatusBarPopupIconPrefListener);
removePopupPermListener(gPopupPermListener);
removeFormSubmitObserver(gFormSubmitObserver);
@@ -915,17 +915,17 @@ function Translate()
}
}
function GetTypePermFromId(aId)
{
// Get type and action from splitting id, first is type, second is action.
var [type, action] = aId.split("_");
var perm = "ACCESS_" + action.toUpperCase();
- return [type, Components.interfaces.nsICookiePermission[perm]];
+ return [type, Ci.nsICookiePermission[perm]];
}
function CheckForVisibility(aEvent, aNode)
{
CheckPermissionsMenu("popup", aNode);
var uri = getBrowser().currentURI;
var allowBlocking = Services.prefs.getBoolPref("dom.disable_open_during_load");
@@ -969,19 +969,19 @@ function CookieImagePopupAction(aElement
Services.prompt.alert(window, aElement.getAttribute("title"),
aElement.getAttribute("msg"));
}
function OpenSessionHistoryIn(aWhere, aDelta, aTab)
{
var win = aWhere == "window" ? null : window;
aTab = aTab || getBrowser().selectedTab;
- var tab = Components.classes["@mozilla.org/suite/sessionstore;1"]
- .getService(Components.interfaces.nsISessionStore)
- .duplicateTab(win, aTab, aDelta, true);
+ var tab = Cc["@mozilla.org/suite/sessionstore;1"]
+ .getService(Ci.nsISessionStore)
+ .duplicateTab(win, aTab, aDelta, true);
var loadInBackground = GetBoolPref("browser.tabs.loadInBackground", false);
switch (aWhere) {
case "tabfocused":
// forces tab to be focused
loadInBackground = true;
// fall through
@@ -1385,23 +1385,23 @@ var BrowserSearch = {
try {
var datasource = RDF.GetDataSourceBlocking(sidebarObj.datasource_uri);
var aboutValue = RDF.GetResource("urn:sidebar:panel:search");
// check if the panel is even in the list by checking for its content
var contentProp = RDF.GetResource("http://home.netscape.com/NC-rdf#content");
var content = datasource.GetTarget(aboutValue, contentProp, true);
- if (content instanceof Components.interfaces.nsIRDFLiteral) {
+ if (content instanceof Ci.nsIRDFLiteral) {
// the search panel entry exists, now check if it is excluded
// for navigator
var excludeProp = RDF.GetResource("http://home.netscape.com/NC-rdf#exclude");
var exclude = datasource.GetTarget(aboutValue, excludeProp, true);
- if (exclude instanceof Components.interfaces.nsIRDFLiteral) {
+ if (exclude instanceof Ci.nsIRDFLiteral) {
searchPanelExists = (exclude.Value.indexOf("navigator:browser") < 0);
} else {
// panel exists and no exclude set
searchPanelExists = true;
}
}
} catch (e) {
searchPanelExists = false;
@@ -1515,39 +1515,39 @@ function BrowserOpenSyncTabs()
/* Show file picker dialog configured for opening a file, and return
* the selected nsIFileURL instance. */
function selectFileToOpen(label, prefRoot)
{
var fileURL = null;
// Get filepicker component.
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, gNavigatorBundle.getString(label), nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterAll | nsIFilePicker.filterText | nsIFilePicker.filterImages |
nsIFilePicker.filterXML | nsIFilePicker.filterHTML);
const filterIndexPref = prefRoot + "filterIndex";
const lastDirPref = prefRoot + "dir";
// use a pref to remember the filterIndex selected by the user.
fp.filterIndex = GetIntPref(filterIndexPref, 0);
// use a pref to remember the displayDirectory selected by the user.
try {
fp.displayDirectory = Services.prefs.getComplexValue(lastDirPref,
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
} catch (ex) {
}
if (fp.show() == nsIFilePicker.returnOK) {
Services.prefs.setIntPref(filterIndexPref, fp.filterIndex);
Services.prefs.setComplexValue(lastDirPref,
- Components.interfaces.nsIFile,
+ Ci.nsIFile,
fp.file.parent);
fileURL = fp.fileURL;
}
return fileURL;
}
function BrowserOpenFileWindow()
@@ -1577,18 +1577,18 @@ function updateCloseItems()
document.getElementById("menu_closeOtherTabs").hidden = hideCloseOtherTabs;
if (!hideCloseOtherTabs)
document.getElementById("cmd_closeOtherTabs").setAttribute("disabled", hideCloseWindow);
}
function updateRecentMenuItems()
{
var browser = getBrowser();
- var ss = Components.classes["@mozilla.org/suite/sessionstore;1"]
- .getService(Components.interfaces.nsISessionStore);
+ var ss = Cc["@mozilla.org/suite/sessionstore;1"]
+ .getService(Ci.nsISessionStore);
var recentTabsItem = document.getElementById("menu_recentTabs");
recentTabsItem.setAttribute("disabled", !browser || browser.getUndoList().length == 0);
var recentWindowsItem = document.getElementById("menu_recentWindows");
recentWindowsItem.setAttribute("disabled", ss.getClosedWindowCount() == 0);
}
function updateRecentTabs(menupopup)
@@ -1613,18 +1613,18 @@ function updateRecentTabs(menupopup)
menuitem.setAttribute("label", label);
menuitem.setAttribute("value", i);
menupopup.appendChild(menuitem);
}
}
function updateRecentWindows(menupopup)
{
- var ss = Components.classes["@mozilla.org/suite/sessionstore;1"]
- .getService(Components.interfaces.nsISessionStore);
+ var ss = Cc["@mozilla.org/suite/sessionstore;1"]
+ .getService(Ci.nsISessionStore);
while (menupopup.hasChildNodes())
menupopup.lastChild.remove();
var undoItems = JSON.parse(ss.getClosedWindowData());
for (var i = 0; i < undoItems.length; i++) {
var menuitem = document.createElement("menuitem");
var label = undoItems[i].title;
@@ -1639,25 +1639,25 @@ function updateRecentWindows(menupopup)
menuitem.setAttribute("label", label);
menuitem.setAttribute("value", i);
menupopup.appendChild(menuitem);
}
}
function undoCloseWindow(aIndex)
{
- var ss = Components.classes["@mozilla.org/suite/sessionstore;1"]
- .getService(Components.interfaces.nsISessionStore);
+ var ss = Cc["@mozilla.org/suite/sessionstore;1"]
+ .getService(Ci.nsISessionStore);
return ss.undoCloseWindow(aIndex);
}
function restoreLastSession() {
- let ss = Components.classes["@mozilla.org/suite/sessionstore;1"]
- .getService(Components.interfaces.nsISessionStore);
+ let ss = Cc["@mozilla.org/suite/sessionstore;1"]
+ .getService(Ci.nsISessionStore);
ss.restoreLastSession();
}
/*
* Determines if a tab is "empty" using isBrowserEmpty from utilityOverlay.js
*/
function isTabEmpty(aTab)
{
@@ -1822,20 +1822,20 @@ function handleURLBarCommand(aUserAction
if (shiftPressed) {
//newWin.blur();
content.focus();
}
}
} else if (saveModifier) {
try {
// Firstly, fixup the url so that (e.g.) "www.foo.com" works
- const nsIURIFixup = Components.interfaces.nsIURIFixup;
+ const nsIURIFixup = Ci.nsIURIFixup;
if (!gURIFixup)
- gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
- .getService(nsIURIFixup);
+ gURIFixup = Cc["@mozilla.org/docshell/urifixup;1"]
+ .getService(nsIURIFixup);
url = gURIFixup.createFixupURI(data.url, nsIURIFixup.FIXUP_FLAGS_MAKE_ALTERNATE_URI).spec;
// Open filepicker to save the url
saveURL(url, null, null, false, true, null, document);
}
catch(ex) {
// XXX Do nothing for now.
// Do we want to put up an alert in the future? Mmm, l10n...
}
@@ -1879,17 +1879,17 @@ function getShortcutOrURIAndPostData(url
}
// A corrupt Places database could make this throw, breaking navigation
// from the location bar.
let entry = null;
try {
entry = await PlacesUtils.keywords.fetch(keyword);
} catch (ex) {
- Components.utils.reportError(`Unable to fetch Places keyword "${keyword}": ${ex}`);
+ Cu.reportError(`Unable to fetch Places keyword "${keyword}": ${ex}`);
}
if (!entry || !entry.url) {
// This is not a Places keyword.
return { url, postData, mayInheritPrincipal };
}
try {
[url, postData] =
@@ -1910,26 +1910,26 @@ function getShortcutOrURIAndPostData(url
return { url, postData, mayInheritPrincipal };
})().then(data => {
return data;
});
}
function getPostDataStream(aStringData, aKeyword, aEncKeyword, aType)
{
- var dataStream = Components.classes["@mozilla.org/io/string-input-stream;1"]
- .createInstance(Components.interfaces.nsIStringInputStream);
+ var dataStream = Cc["@mozilla.org/io/string-input-stream;1"]
+ .createInstance(Ci.nsIStringInputStream);
aStringData = aStringData.replace(/%s/g, aEncKeyword).replace(/%S/g, aKeyword);
dataStream.data = aStringData;
- var mimeStream = Components.classes["@mozilla.org/network/mime-input-stream;1"]
- .createInstance(Components.interfaces.nsIMIMEInputStream);
+ var mimeStream = Cc["@mozilla.org/network/mime-input-stream;1"]
+ .createInstance(Ci.nsIMIMEInputStream);
mimeStream.addHeader("Content-Type", aType);
mimeStream.setData(dataStream);
- return mimeStream.QueryInterface(Components.interfaces.nsIInputStream);
+ return mimeStream.QueryInterface(Ci.nsIInputStream);
}
// handleDroppedLink has the following 2 overloads:
// handleDroppedLink(event, url, name, triggeringPrincipal)
// handleDroppedLink(event, links, triggeringPrincipal)
function handleDroppedLink(event, urlOrLinks, nameOrTriggeringPrincipal, triggeringPrincipal)
{
let links;
@@ -1984,36 +1984,36 @@ function handleDroppedLink(event, urlOrL
}
function readFromClipboard()
{
var url;
try {
// Get the clipboard.
- var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"]
- .getService(Components.interfaces.nsIClipboard);
+ var clipboard = Cc["@mozilla.org/widget/clipboard;1"]
+ .getService(Ci.nsIClipboard);
// Create a transferable that will transfer the text.
- var trans = Components.classes["@mozilla.org/widget/transferable;1"]
- .createInstance(Components.interfaces.nsITransferable);
+ var trans = Cc["@mozilla.org/widget/transferable;1"]
+ .createInstance(Ci.nsITransferable);
trans.init(null);
trans.addDataFlavor("text/unicode");
// If available, use the selection clipboard, otherwise use the global one.
if (clipboard.supportsSelectionClipboard())
clipboard.getData(trans, clipboard.kSelectionClipboard);
else
clipboard.getData(trans, clipboard.kGlobalClipboard);
var data = {};
trans.getTransferData("text/unicode", data, {});
if (data.value) {
- data = data.value.QueryInterface(Components.interfaces.nsISupportsString);
+ data = data.value.QueryInterface(Ci.nsISupportsString);
url = data.data;
}
} catch (ex) {
}
return url;
}
@@ -2039,27 +2039,27 @@ function readFromClipboard()
* want to attempt to retrieve the document source from the network
* cache.
* lineNumber (optional):
* The line number to focus on once the source is loaded.
*/
function BrowserViewSourceOfDocument(aArgsOrDocument) {
if (aArgsOrDocument instanceof Document) {
// Deprecated API - callers should pass args object instead.
- if (Components.utils.isCrossProcessWrapper(aArgsOrDocument)) {
+ if (Cu.isCrossProcessWrapper(aArgsOrDocument)) {
throw new Error("BrowserViewSourceOfDocument cannot accept a CPOW " +
"as a document.");
}
let requestor = aArgsOrDocument.defaultView
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor);
- let browser = requestor.getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
+ .QueryInterface(Ci.nsIInterfaceRequestor);
+ let browser = requestor.getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
- let outerWindowID = requestor.getInterface(Components.interfaces.nsIDOMWindowUtils)
+ let outerWindowID = requestor.getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID;
let URL = browser.currentURI.spec;
aArgsOrDocument = { browser, outerWindowID, URL };
}
gViewSourceUtils.viewSource(aArgsOrDocument);
}
@@ -2143,33 +2143,33 @@ function hiddenWindowStartup()
gNavigatorBundle = document.getElementById("bundle_navigator");
gNavigatorRegionBundle = document.getElementById("bundle_navigator_region");
gBrandBundle = document.getElementById("bundle_brand");
}
function checkForDirectoryListing()
{
if ( "HTTPIndex" in content &&
- content.HTTPIndex instanceof Components.interfaces.nsIHTTPIndex ) {
+ content.HTTPIndex instanceof Ci.nsIHTTPIndex ) {
var forced = getBrowser().docShell.forcedCharset;
if (forced) {
content.defaultCharacterset = forced;
}
}
}
function URLBarSetURI(aURI, aValid) {
var uri = aURI || getWebNavigation().currentURI;
var value;
// If the url has "wyciwyg://" as the protocol, strip it off.
// Nobody wants to see it on the urlbar for dynamically generated pages.
if (!gURIFixup)
- gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
- .getService(Components.interfaces.nsIURIFixup);
+ gURIFixup = Cc["@mozilla.org/docshell/urifixup;1"]
+ .getService(Ci.nsIURIFixup);
try {
uri = gURIFixup.createExposableURI(uri);
} catch (ex) {}
// Replace "about:blank" and other initial pages with an empty string
// only if there's no opener (bug 370555).
if (gInitialPages.has(uri.spec))
value = (content.opener || getWebNavigation().canGoBack) ? uri.spec : "";
@@ -2562,18 +2562,18 @@ function maybeInitPopupContext()
function WindowIsClosing()
{
var browser = getBrowser();
var cn = browser.tabContainer.childNodes;
var numtabs = cn.length;
var reallyClose = true;
if (!gPrivate && !/Mac/.test(navigator.platform) && isClosingLastBrowser()) {
- let closingCanceled = Components.classes["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
+ let closingCanceled = Cc["@mozilla.org/supports-PRBool;1"]
+ .createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(closingCanceled, "browser-lastwindow-close-requested");
if (closingCanceled.data)
return false;
Services.obs.notifyObservers(null, "browser-lastwindow-close-granted");
return true;
}
@@ -2724,32 +2724,31 @@ function updateSavePageItems()
var autoDownload = Services.prefs
.getBoolPref("browser.download.useDownloadDir");
goSetMenuValue("savepage", autoDownload ? "valueSave" : "valueSaveAs");
}
function convertFromUnicode(charset, str)
{
try {
- var unicodeConverter = Components
- .classes["@mozilla.org/intl/scriptableunicodeconverter"]
- .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+ var unicodeConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+ .createInstance(Ci.nsIScriptableUnicodeConverter);
unicodeConverter.charset = charset;
str = unicodeConverter.ConvertFromUnicode(str);
return str + unicodeConverter.Finish();
} catch(ex) {
return null;
}
}
function getNotificationBox(aWindow)
{
- return aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
+ return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.parentNode.wrappedJSObject;
}
function BrowserToolboxCustomizeInit()
{
SetPageProxyState("invalid", null);
toolboxCustomizeInit("main-menubar");
PlacesToolbarHelper.customizeStart();
@@ -2947,31 +2946,31 @@ function AddKeywordForSearchField() {
PlacesUIUtils.showMinimalAddBookmarkUI(makeURI(spec), title, description, null,
null, null, "", postData, charset);
}
function getCert()
{
var sslStatus = getBrowser().securityUI
- .QueryInterface(Components.interfaces.nsISSLStatusProvider)
+ .QueryInterface(Ci.nsISSLStatusProvider)
.SSLStatus;
return sslStatus && sslStatus.serverCert;
}
function viewCertificate()
{
var cert = getCert();
if (cert)
{
- Components.classes["@mozilla.org/nsCertificateDialogs;1"]
- .getService(Components.interfaces.nsICertificateDialogs)
- .viewCert(window, cert);
+ Cc["@mozilla.org/nsCertificateDialogs;1"]
+ .getService(Ci.nsICertificateDialogs)
+ .viewCert(window, cert);
}
}
function openCertManager()
{
toOpenWindowByType("mozilla:certmanager", "chrome://pippki/content/certManager.xul",
"resizable,dialog=no,centerscreen");
}
--- a/suite/browser/navigatorDD.js
+++ b/suite/browser/navigatorDD.js
@@ -22,24 +22,24 @@ var RDFUtils = {
{
var source = this.getResource(aSourceID);
var property = this.getResource(aPropertyID);
return aDS.GetTarget(source, property, true);
},
getValueFromResource: function(aResource)
{
- aResource = aResource.QueryInterface(Components.interfaces.nsIRDFResource);
+ aResource = aResource.QueryInterface(Ci.nsIRDFResource);
return aResource ? aResource.Value : null;
},
_rdf: null,
get rdf() {
if (!this._rdf) {
- this._rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
- .getService(Components.interfaces.nsIRDFService);
+ this._rdf = Cc["@mozilla.org/rdf/rdf-service;1"]
+ .getService(Ci.nsIRDFService);
}
return this._rdf;
}
}
function htmlEscape(aString)
{
return aString.replace(/&/g, "&")
--- a/suite/browser/nsBrowserContentHandler.js
+++ b/suite/browser/nsBrowserContentHandler.js
@@ -1,37 +1,37 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
-const nsISupports = Components.interfaces.nsISupports;
-const nsIBrowserDOMWindow = Components.interfaces.nsIBrowserDOMWindow;
-const nsIBrowserHistory = Components.interfaces.nsIBrowserHistory;
-const nsIBrowserSearchService = Components.interfaces.nsIBrowserSearchService;
-const nsIChannel = Components.interfaces.nsIChannel;
-const nsICommandLine = Components.interfaces.nsICommandLine;
-const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler;
-const nsICommandLineValidator = Components.interfaces.nsICommandLineValidator;
-const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
-const nsIContentHandler = Components.interfaces.nsIContentHandler;
-const nsIDOMWindow = Components.interfaces.nsIDOMWindow;
-const nsIFactory = Components.interfaces.nsIFactory;
-const nsIFileURL = Components.interfaces.nsIFileURL;
-const nsIHttpProtocolHandler = Components.interfaces.nsIHttpProtocolHandler;
-const nsINetUtil = Components.interfaces.nsINetUtil;
-const nsIIOService = Components.interfaces.nsIIOService;
-const nsIPrefService = Components.interfaces.nsIPrefService;
-const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
-const nsIPrefLocalizedString = Components.interfaces.nsIPrefLocalizedString;
-const nsISupportsString = Components.interfaces.nsISupportsString;
-const nsIURIFixup = Components.interfaces.nsIURIFixup;
-const nsIWindowMediator = Components.interfaces.nsIWindowMediator;
-const nsIWebNavigationInfo = Components.interfaces.nsIWebNavigationInfo;
+const nsISupports = Ci.nsISupports;
+const nsIBrowserDOMWindow = Ci.nsIBrowserDOMWindow;
+const nsIBrowserHistory = Ci.nsIBrowserHistory;
+const nsIBrowserSearchService = Ci.nsIBrowserSearchService;
+const nsIChannel = Ci.nsIChannel;
+const nsICommandLine = Ci.nsICommandLine;
+const nsICommandLineHandler = Ci.nsICommandLineHandler;
+const nsICommandLineValidator = Ci.nsICommandLineValidator;
+const nsIComponentRegistrar = Ci.nsIComponentRegistrar;
+const nsIContentHandler = Ci.nsIContentHandler;
+const nsIDOMWindow = Ci.nsIDOMWindow;
+const nsIFactory = Ci.nsIFactory;
+const nsIFileURL = Ci.nsIFileURL;
+const nsIHttpProtocolHandler = Ci.nsIHttpProtocolHandler;
+const nsINetUtil = Ci.nsINetUtil;
+const nsIIOService = Ci.nsIIOService;
+const nsIPrefService = Ci.nsIPrefService;
+const nsIPrefBranch = Ci.nsIPrefBranch;
+const nsIPrefLocalizedString = Ci.nsIPrefLocalizedString;
+const nsISupportsString = Ci.nsISupportsString;
+const nsIURIFixup = Ci.nsIURIFixup;
+const nsIWindowMediator = Ci.nsIWindowMediator;
+const nsIWebNavigationInfo = Ci.nsIWebNavigationInfo;
const NS_ERROR_WONT_HANDLE_CONTENT = 0x805d0001;
const URI_INHERITS_SECURITY_CONTEXT = nsIHttpProtocolHandler
.URI_INHERITS_SECURITY_CONTEXT;
const NS_GENERAL_STARTUP_PREFIX = "@mozilla.org/commandlinehandler/general-startup;1?type=";
@@ -45,34 +45,34 @@ function shouldLoadURI(aURI)
return false;
}
function resolveURIInternal(aCmdLine, aArgument)
{
try {
var file = aCmdLine.resolveFile(aArgument);
if (file.exists()) {
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(nsIIOService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(nsIIOService);
return ioService.newFileURI(file);
}
} catch (e) {
}
// We have interpreted the argument as a relative file URI, but the file
// doesn't exist. Try URI fixup heuristics: see bug 290782.
try {
- var urifixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
- .getService(nsIURIFixup);
+ var urifixup = Cc["@mozilla.org/docshell/urifixup;1"]
+ .getService(nsIURIFixup);
return urifixup.createFixupURI(aArgument,
nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
return null;
}
function getHomePageGroup()
{
var homePage = Services.prefs.getComplexValue("browser.startup.homepage",
@@ -98,51 +98,51 @@ function needHomePageOverride()
var savedmstone = null;
try {
savedmstone = Services.prefs.getCharPref("browser.startup.homepage_override.mstone");
if (savedmstone == "ignore")
return false;
} catch (e) {
}
- var mstone = Components.classes["@mozilla.org/network/protocol;1?name=http"]
- .getService(nsIHttpProtocolHandler).misc;
+ var mstone = Cc["@mozilla.org/network/protocol;1?name=http"]
+ .getService(nsIHttpProtocolHandler).misc;
if (mstone == savedmstone)
return false;
Services.prefs.setCharPref("browser.startup.homepage_override.mstone", mstone);
return true;
}
function getURLToLoad()
{
- var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
- .getService(Components.interfaces.nsIURLFormatter);
+ var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
+ .getService(Ci.nsIURLFormatter);
if (needHomePageOverride()) {
try {
return formatter.formatURLPref("startup.homepage_override_url");
} catch (e) {
}
}
try {
- var ss = Components.classes["@mozilla.org/suite/sessionstartup;1"]
- .getService(Components.interfaces.nsISessionStartup);
+ var ss = Cc["@mozilla.org/suite/sessionstartup;1"]
+ .getService(Ci.nsISessionStartup);
// return about:blank if we are restoring previous session
if (ss.doRestore())
return "about:blank";
} catch (e) {
}
try {
- var st = Components.classes["@mozilla.org/suite/sessionstore;1"]
- .getService(Components.interfaces.nsISessionStore);
+ var st = Cc["@mozilla.org/suite/sessionstore;1"]
+ .getService(Ci.nsISessionStore);
// return about:blank if the last window was closed and should be restored
if (st.doRestoreLastWindow())
return "about:blank";
} catch (e) {
}
try {
switch (Services.prefs.getIntPref("browser.startup.page")) {
@@ -155,18 +155,18 @@ function getURLToLoad()
} catch (e) {
}
return "about:blank";
}
function openWindow(parent, url, features, arg)
{
- var argstring = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(nsISupportsString);
+ var argstring = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(nsISupportsString);
argstring.data = arg;
return Services.ww.openWindow(parent, url, "", features, argstring);
}
function openPreferences()
{
var win = Services.wm.getMostRecentWindow("mozilla:preferences");
if (win)
@@ -198,27 +198,27 @@ function handURIToExistingBrowser(aUri,
}
navWin.browserDOMWindow.openURI(aUri, null, aLocation,
nsIBrowserDOMWindow.OPEN_EXTERNAL,
aTriggeringPrincipal);
}
function doSearch(aSearchTerm, aFeatures) {
- var ss = Components.classes["@mozilla.org/browser/search-service;1"]
- .getService(nsIBrowserSearchService);
+ var ss = Cc["@mozilla.org/browser/search-service;1"]
+ .getService(nsIBrowserSearchService);
var submission = ss.defaultEngine.getSubmission(aSearchTerm);
// fill our nsIMutableArray with uri-as-wstring, null, null, postData
- var sa = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var sa = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
- var uristring = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(nsISupportsString);
+ var uristring = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(nsISupportsString);
uristring.data = submission.uri.spec;
sa.appendElement(uristring);
sa.appendElement(null);
sa.appendElement(null);
sa.appendElement(submission.postData);
// XXXbsmedberg: use handURIToExistingBrowser to obey tabbed-browsing
@@ -237,17 +237,17 @@ var nsBrowserContentHandler = {
if (iid.equals(nsISupports) ||
iid.equals(nsICommandLineHandler) ||
iid.equals(nsICommandLine) ||
iid.equals(nsICommandLineValidator) ||
iid.equals(nsIContentHandler) ||
iid.equals(nsIFactory))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
_handledURI: null,
/* nsICommandLineHandler */
handle: function handle(cmdLine) {
var features = "chrome,all,dialog=no";
try {
@@ -299,33 +299,33 @@ var nsBrowserContentHandler = {
openWindow(null, "chrome://messenger/content", features);
break;
case "composemessage":
openWindow(null, "chrome://messenger/content/messengercompose/messengercompose.xul", features, RegExp.$3);
break;
default:
- throw Components.results.NS_ERROR_ABORT;
+ throw Cr.NS_ERROR_ABORT;
}
break;
default:
// Somebody sent us a remote command we don't know how to process:
// just abort.
- throw Components.results.NS_ERROR_ABORT;
+ throw Cr.NS_ERROR_ABORT;
}
cmdLine.preventDefault = true;
}
} catch (e) {
// If we had a -remote flag but failed to process it, throw
// NS_ERROR_ABORT so that the xremote code knows to return a failure
// back to the handling code.
- throw Components.results.NS_ERROR_ABORT;
+ throw Cr.NS_ERROR_ABORT;
}
try {
var browserParam = cmdLine.handleFlagWithParam("browser", false);
if (browserParam) {
openWindow(null, getBrowserURL(), features, browserParam);
cmdLine.preventDefault = true;
}
@@ -352,22 +352,22 @@ var nsBrowserContentHandler = {
// If we don't have a profile selected yet (e.g. the Profile Manager is
// displayed) we will crash if we open an url and then select a profile. To
// prevent this handle all url command line flag and set the command line's
// preventDefault to true to prevent the display of the ui. The initial
// command line will be retained when nsAppRunner calls LaunchChild though
// urls launched after the initial launch will be lost.
try {
// This will throw when a profile has not been selected.
- var fl = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties);
- fl.get("ProfD", Components.interfaces.nsIFile);
+ var fl = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties);
+ fl.get("ProfD", Ci.nsIFile);
} catch (e) {
cmdLine.preventDefault = true;
- throw Components.results.NS_ERROR_ABORT;
+ throw Cr.NS_ERROR_ABORT;
}
try {
var urlParam = cmdLine.handleFlagWithParam("url", false);
if (urlParam) {
if (this._handledURI == urlParam) {
this._handledURI = null;
} else {
@@ -416,18 +416,18 @@ var nsBrowserContentHandler = {
} catch (e) {
}
try {
var chromeParam = cmdLine.handleFlagWithParam("chrome", false);
if (chromeParam) {
// only load URIs which do not inherit chrome privs
var uri = resolveURIInternal(cmdLine, chromeParam);
- var netutil = Components.classes["@mozilla.org/network/util;1"]
- .getService(nsINetUtil);
+ var netutil = Cc["@mozilla.org/network/util;1"]
+ .getService(nsINetUtil);
if (!netutil.URIChainHasFlags(uri, URI_INHERITS_SECURITY_CONTEXT)) {
openWindow(null, uri.spec, features);
cmdLine.preventDefault = true;
}
}
} catch (e) {
}
@@ -482,37 +482,37 @@ var nsBrowserContentHandler = {
for (var i = 0; i < startupArray.length; ++i) {
this.currentArgument = startupArray[i];
var contract = NS_GENERAL_STARTUP_PREFIX + this.currentArgument;
if (contract in Components.classes) {
// Ignore any exceptions - we can't do anything about them here.
try {
if (prefBranch.getBoolPref(this.currentArgument)) {
- var handler = Components.classes[contract].getService(nsICommandLineHandler);
+ var handler = Cc[contract].getService(nsICommandLineHandler);
if (handler.wrappedJSObject)
handler.wrappedJSObject.handle(this);
else
handler.handle(this);
}
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
}
this.realCmdLine = null;
}
if (!cmdLine.preventDefault) {
var homePage = getURLToLoad();
if (!/\n/.test(homePage)) {
try {
- var urifixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
- .getService(nsIURIFixup);
+ var urifixup = Cc["@mozilla.org/docshell/urifixup;1"]
+ .getService(nsIURIFixup);
var uri = urifixup.createFixupURI(homePage, 0);
handURIToExistingBrowser(uri, nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW, features);
cmdLine.preventDefault = true;
} catch (e) {
}
}
if (!cmdLine.preventDefault) {
@@ -536,17 +536,17 @@ var nsBrowserContentHandler = {
// flag is also present and the command line is valid.
["url", "news", "compose"].forEach(function(value) {
var flagIdx = cmdLine.findFlag(value, false);
if (flagIdx > -1) {
var testExpr = new RegExp("seamonkey" + value + ":");
if (cmdLine.length != flagIdx + 2 ||
testExpr.test(cmdLine.getArgument(flagIdx + 1)))
- throw Components.results.NS_ERROR_ABORT;
+ throw Cr.NS_ERROR_ABORT;
cmdLine.handleFlag("osint", false);
}
});
},
helpInfo: " -browser <url> Open a browser window.\n" +
" -private <url> Open a private window.\n" +
" -new-window <url> Open <url> in a new browser window.\n" +
@@ -558,17 +558,17 @@ var nsBrowserContentHandler = {
/* nsICommandLine */
length: 1,
getArgument: function getArgument(index) {
if (index == 0)
return this.currentArgument;
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
},
findFlag: function findFlag(flag, caseSensitive) {
if (caseSensitive)
return flag == this.currentArgument ? 0 : -1;
return flag.toLowerCase() == this.currentArgument.toLowerCase() ? 0 : -1;
},
@@ -579,17 +579,17 @@ var nsBrowserContentHandler = {
handleFlag: function handleFlag(flag, caseSensitive) {
if (caseSensitive)
return flag == this.currentArgument;
return flag.toLowerCase() == this.currentArgument.toLowerCase();
},
handleFlagWithParam : function handleFlagWithParam(flag, caseSensitive) {
if (this.handleFlag(flag, caseSensitive))
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
},
get state() {
return this.realCmdLine.state;
},
get preventDefault() {
return this.realCmdLine.preventDefault;
@@ -612,41 +612,41 @@ var nsBrowserContentHandler = {
},
resolveURI: function resolveURI(arg) {
return this.realCmdLine.resolveURI(arg);
},
/* nsIContentHandler */
handleContent: function handleContent(contentType, context, request) {
- var webNavInfo = Components.classes["@mozilla.org/webnavigation-info;1"]
- .getService(nsIWebNavigationInfo);
+ var webNavInfo = Cc["@mozilla.org/webnavigation-info;1"]
+ .getService(nsIWebNavigationInfo);
if (!webNavInfo.isTypeSupported(contentType, null))
throw NS_ERROR_WONT_HANDLE_CONTENT;
request.QueryInterface(nsIChannel);
handURIToExistingBrowser(request.URI,
nsIBrowserDOMWindow.OPEN_DEFAULTWINDOW,
"chrome,all,dialog=no",
request.loadInfo.triggeringPrincipal);
- request.cancel(Components.results.NS_BINDING_ABORTED);
+ request.cancel(Cr.NS_BINDING_ABORTED);
},
/* nsIFactory */
createInstance: function createInstance(outer, iid) {
if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid);
},
lockFactory: function lockFactory(lock) {
/* no-op */
}
};
const BROWSER_CID = Components.ID("{c2343730-dc2c-11d3-98b3-001083010e9b}");
function NSGetFactory(cid) {
if (cid.number == BROWSER_CID)
return nsBrowserContentHandler;
- throw Components.results.NS_ERROR_FACTORY_NOT_REGISTERED;
+ throw Cr.NS_ERROR_FACTORY_NOT_REGISTERED;
}
--- a/suite/browser/nsBrowserContentListener.js
+++ b/suite/browser/nsBrowserContentListener.js
@@ -1,14 +1,14 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-const nsIWebBrowserChrome = Components.interfaces.nsIWebBrowserChrome;
+const nsIWebBrowserChrome = Ci.nsIWebBrowserChrome;
function nsBrowserContentListener(toplevelWindow, contentWindow)
{
// this one is not as easy as you would hope.
// need to convert toplevelWindow to an XPConnected object, instead
// of a DOM-based object, to be able to QI() it to nsIXULWindow
this.init(toplevelWindow, contentWindow);
@@ -22,61 +22,61 @@ nsBrowserContentListener.prototype =
{
this.toplevelWindow = toplevelWindow;
this.contentWindow = contentWindow;
// hook up the whole parent chain thing
var windowDocShell = this.convertWindowToDocShell(toplevelWindow);
if (windowDocShell) {
windowDocshell
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIURIContentListener)
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIURIContentListener)
.parentContentListener = this;
}
var registerWindow = false;
try {
- var treeItem = contentWindow.docShell.QueryInterface(Components.interfaces.nsIDocShellTreeItem);
+ var treeItem = contentWindow.docShell.QueryInterface(Ci.nsIDocShellTreeItem);
var treeOwner = treeItem.treeOwner;
- var interfaceRequestor = treeOwner.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
+ var interfaceRequestor = treeOwner.QueryInterface(Ci.nsIInterfaceRequestor);
var webBrowserChrome = interfaceRequestor.getInterface(nsIWebBrowserChrome);
if (webBrowserChrome)
{
var chromeFlags = webBrowserChrome.chromeFlags;
var res = chromeFlags & nsIWebBrowserChrome.CHROME_ALL;
var res2 = chromeFlags & nsIWebBrowserChrome.CHROME_DEFAULT;
if ( res == nsIWebBrowserChrome.CHROME_ALL || res2 == nsIWebBrowserChrome.CHROME_DEFAULT)
{
registerWindow = true;
}
}
} catch (ex) {}
// register ourselves
if (registerWindow)
{
- var uriLoader = Components.classes["@mozilla.org/uriloader;1"].getService(Components.interfaces.nsIURILoader);
+ var uriLoader = Cc["@mozilla.org/uriloader;1"].getService(Ci.nsIURILoader);
uriLoader.registerContentListener(this);
}
},
close: function()
{
this.contentWindow = null;
- var uriLoader = Components.classes["@mozilla.org/uriloader;1"].getService(Components.interfaces.nsIURILoader);
+ var uriLoader = Cc["@mozilla.org/uriloader;1"].getService(Ci.nsIURILoader);
uriLoader.unRegisterContentListener(this);
},
QueryInterface: function(iid)
{
- if (iid.equals(Components.interfaces.nsIURIContentListener) ||
- iid.equals(Components.interfaces.nsISupportsWeakReference) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIURIContentListener) ||
+ iid.equals(Ci.nsISupportsWeakReference) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
onStartURIOpen: function(uri)
{
// ignore and don't abort
return false;
},
doContent: function(contentType, isContentPreferred, request, contentHandler)
@@ -87,18 +87,18 @@ nsBrowserContentListener.prototype =
var newTab = gBrowser.loadOneTab("about:blank", {
inBackground: Services.prefs.getBoolPref("browser.tabs.loadDivertedInBackground")});
docShell = gBrowser.getBrowserForTab(newTab).docShell;
}
var contentListener;
try {
contentListener =
- docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIURIContentListener);
+ docShell.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIURIContentListener);
} catch (ex) {
dump(ex);
}
if (!contentListener) return false;
return contentListener.doContent(contentType, isContentPreferred, request, contentHandler);
@@ -106,32 +106,32 @@ nsBrowserContentListener.prototype =
isPreferred: function(contentType, desiredContentType)
{
if (Services.prefs.getIntPref("browser.link.open_external") == nsIBrowserDOMWindow.OPEN_NEWWINDOW)
return false;
try {
var webNavInfo =
- Components.classes["@mozilla.org/webnavigation-info;1"]
- .getService(Components.interfaces.nsIWebNavigationInfo);
+ Cc["@mozilla.org/webnavigation-info;1"]
+ .getService(Ci.nsIWebNavigationInfo);
return webNavInfo.isTypeSupported(contentType, null);
} catch (e) {
// XXX propagate failures other than "NS_ERROR_NOT_AVAILABLE"?
// This seems to never get called, so not like it matters....
return false;
}
},
canHandleContent: function(contentType, isContentPreferred, desiredContentType)
{
var docShell = this.contentWindow.docShell;
var contentListener;
try {
contentListener =
- docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIURIContentListener);
+ docShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIURIContentListener);
} catch (ex) {
dump(ex);
}
if (!contentListener) return false;
return contentListener.canHandleContent(contentType, isContentPreferred, desiredContentType);
},
convertWindowToDocShell: function(win) {
--- a/suite/browser/nsBrowserStatusHandler.js
+++ b/suite/browser/nsBrowserStatusHandler.js
@@ -15,22 +15,22 @@ nsBrowserStatusHandler.prototype =
defaultStatus : "",
jsStatus : "",
jsDefaultStatus : "",
overLink : "",
feeds : [],
QueryInterface : function(aIID)
{
- if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsIXULBrowserWindow) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIWebProgressListener) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsIXULBrowserWindow) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
init : function()
{
this.urlBar = document.getElementById("urlbar");
this.throbberElement = document.getElementById("navigator-throbber");
this.statusMeter = document.getElementById("statusbar-icon");
this.statusPanel = document.getElementById("statusbar-progresspanel");
@@ -40,17 +40,17 @@ nsBrowserStatusHandler.prototype =
this.statusTextField = document.getElementById("statusbar-display");
this.isImage = document.getElementById("isImage");
this.securityButton = document.getElementById("security-button");
this.evButton = document.getElementById("ev-button");
this.feedsMenu = document.getElementById("feedsMenu");
this.feedsButton = document.getElementById("feedsButton");
// Initialize the security button's state and tooltip text
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
this.onSecurityChange(null, null, nsIWebProgressListener.STATE_IS_INSECURE);
},
destroy : function()
{
// XXXjag to avoid leaks :-/, see bug 60729
this.urlBar = null;
this.throbberElement = null;
@@ -178,18 +178,18 @@ nsBrowserStatusHandler.prototype =
// attrs on XUL elements. -- hyatt
var percentage = (aCurTotalProgress * 100) / aMaxTotalProgress;
this.statusMeter.value = percentage;
}
},
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
{
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
- const nsIChannel = Components.interfaces.nsIChannel;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
+ const nsIChannel = Ci.nsIChannel;
var ctype;
if (aStateFlags & nsIWebProgressListener.STATE_START) {
// This (thanks to the filter) is a network start or the first
// stray request (the first request outside of the document load),
// initialize the throbber and his friends.
// Call start document load listeners (only if this is a network load)
if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK &&
@@ -221,20 +221,20 @@ nsBrowserStatusHandler.prototype =
// and progress bars and such
if (aRequest) {
var msg = "";
// Get the channel if the request is a channel
if (aRequest instanceof nsIChannel) {
var location = aRequest.URI.spec;
if (location != "about:blank") {
switch (aStatus) {
- case Components.results.NS_BINDING_ABORTED:
+ case Cr.NS_BINDING_ABORTED:
msg = gNavigatorBundle.getString("nv_stopped");
break;
- case Components.results.NS_ERROR_NET_TIMEOUT:
+ case Cr.NS_ERROR_NET_TIMEOUT:
msg = gNavigatorBundle.getString("nv_timeout");
break;
}
}
}
// If msg is false then we did not have an error (channel may have
// been null, in the case of a stray image load).
if (!msg) {
@@ -260,17 +260,17 @@ nsBrowserStatusHandler.prototype =
this.stopButton.disabled = true;
this.stopMenu.setAttribute('disabled', 'true');
this.stopContext.setAttribute('disabled', 'true');
}
},
onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags)
{
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
if (gContextMenu) {
// Optimise for the common case
if (aWebProgress.isTopLevel)
document.getElementById("contentAreaContextMenu").hidePopup();
else {
for (var contextWindow = gContextMenu.target.ownerDocument.defaultView;
contextWindow != contextWindow.parent;
contextWindow = contextWindow.parent) {
@@ -354,30 +354,30 @@ nsBrowserStatusHandler.prototype =
onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage)
{
this.status = aMessage;
this.updateStatusField();
},
onSecurityChange : function(aWebProgress, aRequest, aState)
{
- const wpl = Components.interfaces.nsIWebProgressListener;
+ const wpl = Ci.nsIWebProgressListener;
const wpl_security_bits = wpl.STATE_IS_SECURE |
wpl.STATE_IS_BROKEN |
wpl.STATE_IS_INSECURE;
var highlightSecure =
Services.prefs.getBoolPref("browser.urlbar.highlight.secure");
/* aState is defined as a bitmask that may be extended in the future.
* We filter out any unknown bits before testing for known values.
*/
switch (aState & wpl_security_bits) {
case wpl.STATE_IS_SECURE:
- const nsISSLStatusProvider = Components.interfaces.nsISSLStatusProvider;
+ const nsISSLStatusProvider = Ci.nsISSLStatusProvider;
var cert = getBrowser().securityUI.QueryInterface(nsISSLStatusProvider)
.SSLStatus.serverCert;
var issuerName = cert.issuerOrganization ||
cert.issuerCommonName || cert.issuerName;
this.securityButton.setAttribute("tooltiptext",
gNavigatorBundle.getFormattedString("securityButtonTooltipSecure",
[issuerName]));
this.securityButton.setAttribute("level", "high");
@@ -402,32 +402,32 @@ nsBrowserStatusHandler.prototype =
this.securityButton.removeAttribute("level");
this.urlBar.removeAttribute("level");
break;
}
if (aState & wpl.STATE_IDENTITY_EV_TOPLEVEL) {
var organization =
getBrowser().securityUI
- .QueryInterface(Components.interfaces.nsISSLStatusProvider)
+ .QueryInterface(Ci.nsISSLStatusProvider)
.SSLStatus
- .QueryInterface(Components.interfaces.nsISSLStatus)
+ .QueryInterface(Ci.nsISSLStatus)
.serverCert.organization;
this.securityButton.setAttribute("label", organization);
this.evButton.setAttribute("tooltiptext", organization);
this.evButton.hidden = false;
} else {
this.securityButton.removeAttribute("label");
this.evButton.hidden = true;
}
},
startDocumentLoad : function(aRequest)
{
- var uri = aRequest.QueryInterface(Components.interfaces.nsIChannel).originalURI;
+ var uri = aRequest.QueryInterface(Ci.nsIChannel).originalURI;
// clear out search-engine data
getBrowser().selectedBrowser.engines = null;
// Set the URI now if it isn't already set, so that the user can tell which
// site is loading. Only do this if user requested the load via chrome UI,
// to minimise spoofing risk.
if (!content.opener &&
@@ -438,17 +438,17 @@ nsBrowserStatusHandler.prototype =
try {
Services.obs.notifyObservers(content, "StartDocumentLoad", uri.spec);
} catch (e) {
}
},
endDocumentLoad : function(aRequest, aStatus)
{
- const nsIChannel = Components.interfaces.nsIChannel;
+ const nsIChannel = Ci.nsIChannel;
var urlStr = aRequest.QueryInterface(nsIChannel).originalURI.spec;
if (Components.isSuccessCode(aStatus))
dump("Document "+urlStr+" loaded successfully\n"); // per QA request
else {
// per QA request
var e = new Components.Exception("", aStatus);
var name = e.name;
--- a/suite/browser/nsTypeAheadFind.js
+++ b/suite/browser/nsTypeAheadFind.js
@@ -62,56 +62,56 @@ typeAheadFind.prototype = {
mLinks: false,
mSearchString: "",
mSelection: null,
mTimer: null,
mXULBrowserWindow: null,
/* nsISupports */
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsISupportsWeakReference,
- Components.interfaces.nsIObserver,
- Components.interfaces.nsITimerCallback,
- Components.interfaces.nsIDOMEventListener,
- Components.interfaces.nsISelectionListener]),
+ Ci.nsISupportsWeakReference,
+ Ci.nsIObserver,
+ Ci.nsITimerCallback,
+ Ci.nsIDOMEventListener,
+ Ci.nsISelectionListener]),
/* nsIObserver */
observe: function(aSubject, aTopic, aData) {
if (aTopic == "app-startup") {
// It's now safe to get our pref branch.
this.mPrefs = Services.prefs.getBranch("accessibility.typeaheadfind.");
// We need to add our event listeners to all windows.
Services.ww.registerNotification(this);
// We also need to listen for find again commands
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService)
- .addObserver(this, "nsWebBrowserFind_FindAgain", true);
+ Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService)
+ .addObserver(this, "nsWebBrowserFind_FindAgain", true);
}
if (aTopic == "domwindowopened") {
// Add our listeners. They get automatically removed on window teardown.
aSubject.controllers.appendController(new findTypeController(this, aSubject));
- Components.classes["@mozilla.org/eventlistenerservice;1"]
- .getService(Components.interfaces.nsIEventListenerService)
- .addSystemEventListener(aSubject, "keypress", this, false);
+ Cc["@mozilla.org/eventlistenerservice;1"]
+ .getService(Ci.nsIEventListenerService)
+ .addSystemEventListener(aSubject, "keypress", this, false);
}
if (aTopic == "nsWebBrowserFind_FindAgain" &&
- aSubject instanceof Components.interfaces.nsISupportsInterfacePointer &&
- aSubject.data instanceof Components.interfaces.nsIDOMWindow &&
+ aSubject instanceof Ci.nsISupportsInterfacePointer &&
+ aSubject.data instanceof Ci.nsIDOMWindow &&
aSubject.data.top == this.mCurrentWindow &&
this.mSearchString) {
// It's a find again. Was it one that we just searched for?
var w = aSubject.data;
- var find = w.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebBrowserFind);
+ var find = w.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebBrowserFind);
if (find.searchString.toLowerCase() == this.mSearchString) {
var reverse = aData == "up";
this.stopFind(false);
- var result = Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND;
+ var result = Ci.nsITypeAheadFind.FIND_NOTFOUND;
if (!this.mBadKeysSinceMatch)
result = this.mFind.findAgain(reverse, this.mLinks);
this.showStatusMatch(result, reverse ? "prevmatch" : "nextmatch");
// Don't let anyone else try to find again.
aSubject.data = null;
}
}
},
@@ -133,17 +133,17 @@ typeAheadFind.prototype = {
return true;
if (aEvent.type != "keypress") {
aEvent.stopPropagation();
return true;
}
// Are we already in a find?
- if (aEvent.eventPhase == Components.interfaces.nsIDOMEvent.CAPTURING_PHASE)
+ if (aEvent.eventPhase == Ci.nsIDOMEvent.CAPTURING_PHASE)
return this.processKey(aEvent);
// Check whether we want to start a new find.
if (aEvent.defaultPrevented)
return true;
// We don't want to start a find on a control character.
// We also don't want to start on a space, since that scrolls the page.
@@ -154,41 +154,41 @@ typeAheadFind.prototype = {
var window = aEvent.currentTarget;
var element = window.document.commandDispatcher.focusedElement;
if (element.nodeType == element.ELEMENT_NODE &&
element.namespaceURI == "http://www.w3.org/1999/xhtml" &&
element.isContentEditable)
return true;
// Don't start a find if the focus is on a form element.
- if (element instanceof Components.interfaces.nsIDOMXULElement ||
- element instanceof Components.interfaces.nsIDOMHTMLEmbedElement ||
- element instanceof Components.interfaces.nsIDOMHTMLObjectElement ||
+ if (element instanceof Ci.nsIDOMXULElement ||
+ element instanceof Ci.nsIDOMHTMLEmbedElement ||
+ element instanceof Ci.nsIDOMHTMLObjectElement ||
ChromeUtils.getClassName(element) === "HTMLSelectElement" ||
ChromeUtils.getClassName(element) === "HTMLTextAreaElement")
return true;
// Don't start a find if the focus is on an editable field
- if (element instanceof Components.interfaces.nsIDOMHTMLInputElement &&
+ if (element instanceof Ci.nsIDOMHTMLInputElement &&
element.mozIsTextField(false))
return true;
// Don't start a find if the focus isn't or can't be set to content
var w = window.document.commandDispatcher.focusedWindow;
if (w.top == window)
w = window.content;
if (!w)
return true;
- var webNav = w.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation);
+ var webNav = w.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation);
try {
// Don't start a find if the window is in design mode
- if (webNav.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIEditingSession)
+ if (webNav.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIEditingSession)
.windowIsEditable(w))
return true;
} catch (e) {
}
switch (aEvent.charCode) {
// Start finding text as you type
case kSlash:
@@ -202,17 +202,17 @@ typeAheadFind.prototype = {
this.startFind(window, true);
break;
default:
// Don't start if typeahead find is disabled
if (!this.mPrefs.getBoolPref("autostart"))
return true;
// Don't start in windows that don't want autostart
- if (webNav.QueryInterface(Components.interfaces.nsIDocShell)
+ if (webNav.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.getAttribute("autofind") == "false")
return true;
this.startFind(window, this.mPrefs.getBoolPref("linksonly"));
this.processKey(aEvent);
}
return false;
},
@@ -232,48 +232,48 @@ typeAheadFind.prototype = {
},
showStatusMatch: function(aResult, aExtra) {
// Set the status text from a find result
// link|text "..." [not] found [next|previous match] [(href)]
if (aExtra)
aExtra = " " + this.mBundle.GetStringFromName(aExtra);
var url = "";
var string = this.mLinks ? "link" : "text";
- if (aResult == Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND)
+ if (aResult == Ci.nsITypeAheadFind.FIND_NOTFOUND)
string += "not";
else if (this.mFind.foundLink && this.mFind.foundLink.href)
url = " " + this.mBundle.GetStringFromName("openparen") +
this.mFind.foundLink.href +
this.mBundle.GetStringFromName("closeparen");
string += "found";
this.showStatus(this.mBundle.GetStringFromName(string) +
this.mSearchString +
this.mBundle.GetStringFromName("closequote") +
aExtra + url);
},
startTimer: function() {
if (this.mPrefs.getBoolPref("enabletimeout")) {
if (!this.mTimer)
- this.mTimer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ this.mTimer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
this.mTimer.initWithCallback(this,
this.mPrefs.getIntPref("timeout"),
- Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ Ci.nsITimer.TYPE_ONE_SHOT);
}
},
processKey: function(aEvent) {
// Escape always cancels the find.
if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) {
aEvent.preventDefault();
aEvent.stopPropagation();
this.stopFind(false);
return false;
}
- var result = Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND;
+ var result = Ci.nsITypeAheadFind.FIND_NOTFOUND;
if (aEvent.keyCode == aEvent.DOM_VK_BACK_SPACE) {
aEvent.preventDefault();
aEvent.stopPropagation();
this.mSearchString = this.mSearchString.slice(0, -1);
// Backspacing past the start of the string cancels the find.
if (!this.mSearchString) {
this.stopFind(true);
return false;
@@ -303,83 +303,83 @@ typeAheadFind.prototype = {
this.mEventTarget.removeEventListener("blur", this, true);
if (this.mSelection)
this.mSelection.removeSelectionListener(this);
var previousString = this.mSearchString;
this.mSearchString += String.fromCharCode(aEvent.charCode).toLowerCase();
if (!this.mBadKeysSinceMatch) {
result = this.mFind.find(this.mSearchString, this.mLinks);
if (previousString &&
- result == Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND)
+ result == Ci.nsITypeAheadFind.FIND_NOTFOUND)
// Use a separate find instance to rehighlight the previous match
// until bug 463294 is fixed.
this.mFound.find(previousString, this.mLinks);
}
- if (result == Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND)
+ if (result == Ci.nsITypeAheadFind.FIND_NOTFOUND)
this.mBadKeysSinceMatch++;
}
// Ensure that the correct frame is focused (work around for bug 485213).
if (this.mFind.currentWindow)
this.mFind.currentWindow.focus();
this.showStatusMatch(result, "");
if (!this.mFindService)
- this.mFindService = Components.classes["@mozilla.org/find/find_service;1"]
- .getService(Components.interfaces.nsIFindService);
+ this.mFindService = Cc["@mozilla.org/find/find_service;1"]
+ .getService(Ci.nsIFindService);
this.mFindService.searchString = this.mSearchString;
// Watch for blur changes in case the cursor leaves the current field.
this.mEventTarget.addEventListener("blur", this, true);
// Also watch for the cursor moving within the current field or window.
var commandDispatcher = this.mEventTarget.ownerDocument.commandDispatcher;
var editable = commandDispatcher.focusedElement;
- if (editable instanceof Components.interfaces.nsIDOMNSEditableElement)
+ if (editable instanceof Ci.nsIDOMNSEditableElement)
this.mSelection = editable.editor.selection;
else
this.mSelection = commandDispatcher.focusedWindow.getSelection();
- this.mSelection.QueryInterface(Components.interfaces.nsISelectionPrivate)
+ this.mSelection.QueryInterface(Ci.nsISelectionPrivate)
.addSelectionListener(this);
return false;
},
startFind: function(aWindow, aLinks) {
if (this.mEventTarget)
this.stopFind(true);
// Try to get the status bar for the specified window
this.mXULBrowserWindow =
- aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+ aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIXULWindow)
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIXULWindow)
.XULBrowserWindow;
// If the current window is chrome then focus content instead
var w = aWindow.document.commandDispatcher.focusedWindow.top;
if (w == aWindow)
(w = aWindow.content).focus();
// Get two toolkit typeaheadfind instances if we don't have them already.
- var docShell = w.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell);
+ var docShell = w.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell);
if (!this.mFind) {
- this.mFind = Components.classes["@mozilla.org/typeaheadfind;1"]
- .createInstance(Components.interfaces.nsITypeAheadFind);
+ this.mFind = Cc["@mozilla.org/typeaheadfind;1"]
+ .createInstance(Ci.nsITypeAheadFind);
this.mFind.init(docShell);
- this.mFound = Components.classes["@mozilla.org/typeaheadfind;1"]
- .createInstance(Components.interfaces.nsITypeAheadFind);
+ this.mFound = Cc["@mozilla.org/typeaheadfind;1"]
+ .createInstance(Ci.nsITypeAheadFind);
this.mFound.init(docShell);
}
// Get the string bundle if we don't have it already.
if (!this.mBundle)
- this.mBundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle("chrome://communicator/locale/typeaheadfind.properties");
+ this.mBundle = Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle("chrome://communicator/locale/typeaheadfind.properties");
// Set up all our properties
this.mFind.setDocShell(docShell);
this.mFound.setDocShell(docShell);
this.mEventTarget = docShell.chromeEventHandler;
this.mEventTarget.addEventListener("keypress", this, true);
this.mEventTarget.addEventListener("keydown", this, true);
this.mEventTarget.addEventListener("keyup", this, true);
@@ -391,17 +391,17 @@ typeAheadFind.prototype = {
this.showStatusString(this.mLinks ? "startlinkfind" : "starttextfind");
this.startTimer();
},
stopFind: function(aClear) {
if (this.mTimer)
this.mTimer.cancel();
if (this.mFind)
this.mFind.setSelectionModeAndRepaint(
- Components.interfaces.nsISelectionController.SELECTION_ON);
+ Ci.nsISelectionController.SELECTION_ON);
if (this.mEventTarget) {
this.mEventTarget.removeEventListener("blur", this, true);
this.mEventTarget.removeEventListener("pagehide", this, true);
this.mEventTarget.removeEventListener("keypress", this, true);
this.mEventTarget.removeEventListener("keydown", this, true);
this.mEventTarget.removeEventListener("keyup", this, true);
}
this.mEventTarget = null;
--- a/suite/browser/pageinfo/pageInfo.js
+++ b/suite/browser/pageinfo/pageInfo.js
@@ -216,32 +216,32 @@ var gStrings = { };
var gBundle;
const DRAGSERVICE_CONTRACTID = "@mozilla.org/widget/dragservice;1";
const TRANSFERABLE_CONTRACTID = "@mozilla.org/widget/transferable;1";
const STRING_CONTRACTID = "@mozilla.org/supports-string;1";
// a number of services I'll need later
// the cache services
-const OPEN_READONLY = Components.interfaces.nsICacheStorage.OPEN_READONLY;
-const ENTRY_WANTED = Components.interfaces.nsICacheEntryOpenCallback.ENTRY_WANTED;
-const LoadContextInfo = Components.classes["@mozilla.org/load-context-info-factory;1"]
- .getService(Components.interfaces.nsILoadContextInfoFactory);
+const OPEN_READONLY = Ci.nsICacheStorage.OPEN_READONLY;
+const ENTRY_WANTED = Ci.nsICacheEntryOpenCallback.ENTRY_WANTED;
+const LoadContextInfo = Cc["@mozilla.org/load-context-info-factory;1"]
+ .getService(Ci.nsILoadContextInfoFactory);
var loadContextInfo = opener.gPrivate ? LoadContextInfo.private :
LoadContextInfo.default;
const diskCacheStorage =
- Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
- .getService(Components.interfaces.nsICacheStorageService)
- .diskCacheStorage(loadContextInfo, false);
+ Cc["@mozilla.org/netwerk/cache-storage-service;1"]
+ .getService(Ci.nsICacheStorageService)
+ .diskCacheStorage(loadContextInfo, false);
-const nsICertificateDialogs = Components.interfaces.nsICertificateDialogs;
+const nsICertificateDialogs = Ci.nsICertificateDialogs;
const CERTIFICATEDIALOGS_CONTRACTID = "@mozilla.org/nsCertificateDialogs;1"
// Interface for image loading content
-const nsIImageLoadingContent = Components.interfaces.nsIImageLoadingContent;
+const nsIImageLoadingContent = Ci.nsIImageLoadingContent;
// namespaces, don't need all of these yet...
const MathMLNS = "http://www.w3.org/1998/Math/MathML";
const XLinkNS = "http://www.w3.org/1999/xlink";
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const XMLNS = "http://www.w3.org/XML/1998/namespace";
const XHTMLNS = "http://www.w3.org/1999/xhtml";
const XHTML2NS = "http://www.w3.org/2002/06/xhtml2"
@@ -846,27 +846,27 @@ function getSelectedImage(tree)
// Only works if only one item is selected
var clickedRow = tree.currentIndex;
// image-node
return gImageView.data[clickedRow][COL_IMAGE_NODE];
}
function selectSaveFolder()
{
- const nsIFile = Components.interfaces.nsIFile;
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ const nsIFile = Ci.nsIFile;
+ const nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
var titleText = gBundle.getString("mediaSelectFolder");
fp.init(window, titleText, nsIFilePicker.modeGetFolder);
var initialDir = GetLocalFilePref("browser.download.lastDir");
if (!initialDir) {
- let dnldMgr = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ let dnldMgr = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
initialDir = dnldMgr.userDownloadsDirectory;
}
fp.displayDirectory = initialDir;
fp.appendFilters(nsIFilePicker.filterAll);
var ret = fp.show();
if (ret == nsIFilePicker.returnOK)
@@ -915,17 +915,17 @@ function saveMedia()
for (var i = 0; i < rowArray.length; i++) {
var v = rowArray[i];
var dir = odir.clone();
var item = gImageView.data[v][COL_IMAGE_NODE];
var uriString = gImageView.data[v][COL_IMAGE_ADDRESS];
var uri = makeURI(uriString);
try {
- uri.QueryInterface(Components.interfaces.nsIURL);
+ uri.QueryInterface(Ci.nsIURL);
dir.append(decodeURIComponent(uri.fileName));
}
catch(ex) { /* data: uris */ }
if (i == 0)
saveAnImage(uriString, new AutoChosen(dir, uri), makeURI(item.baseURI));
else {
// This delay is a hack which prevents the download manager
@@ -1203,17 +1203,17 @@ function makeBlockImage(url)
var imagePermissionObserver = {
observe: function (aSubject, aTopic, aData)
{
if (document.getElementById("mediaPreviewBox").collapsed)
return;
if (aTopic == "perm-changed") {
- var permission = aSubject.QueryInterface(Components.interfaces.nsIPermission);
+ var permission = aSubject.QueryInterface(Ci.nsIPermission);
if (permission.type == "image") {
var imageTree = document.getElementById("imagetree");
var row = imageTree.currentIndex;
var item = gImageView.data[row][COL_IMAGE_NODE];
var url = gImageView.data[row][COL_IMAGE_ADDRESS];
if (permission.matchesURI(makeURI(url), true))
makeBlockImage(url);
}
@@ -1354,19 +1354,19 @@ function getSelectedItems(linksMode)
return text;
}
function doCopy(isLinkMode)
{
var text = getSelectedItems(isLinkMode);
- Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper)
- .copyString(text.join("\n"));
+ Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper)
+ .copyString(text.join("\n"));
}
function doSelectAll()
{
var elem = document.commandDispatcher.focusedElement;
if (elem && "treeBoxObject" in elem)
elem.view.selection.selectAll();
--- a/suite/browser/pageinfo/permissions.js
+++ b/suite/browser/pageinfo/permissions.js
@@ -1,17 +1,17 @@
/* -*- Mode: Javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This Source Code Form is "Incompatible With Secondary Licenses", as
* defined by the Mozilla Public License, v. 2.0. */
-const nsICookiePermission = Components.interfaces.nsICookiePermission;
+const nsICookiePermission = Ci.nsICookiePermission;
const ALLOW = Services.perms.ALLOW_ACTION; // 1
const BLOCK = Services.perms.DENY_ACTION; // 2
const SESSION = nsICookiePermission.ACCESS_SESSION;// 8
var gPermPrincipal;
var gPermObj = {
image: function getImageDefaultPermission()
{
@@ -53,17 +53,17 @@ var gPermObj = {
return BLOCK;
}
};
var permissionObserver = {
observe: function (aSubject, aTopic, aData)
{
if (aTopic == "perm-changed") {
- var permission = aSubject.QueryInterface(Components.interfaces.nsIPermission);
+ var permission = aSubject.QueryInterface(Ci.nsIPermission);
if (permission.type in gPermObj && permission.matches(gPermPrincipal, true))
initRow(permission.type);
}
}
};
function initPermission()
{
--- a/suite/browser/pageinfo/security.js
+++ b/suite/browser/pageinfo/security.js
@@ -6,22 +6,22 @@
var security = {
// Display the server certificate (static)
viewCert : function () {
var cert = security._cert;
viewCertHelper(window, cert);
},
_getSecurityInfo : function() {
- const nsIX509Cert = Components.interfaces.nsIX509Cert;
- const nsIX509CertDB = Components.interfaces.nsIX509CertDB;
+ const nsIX509Cert = Ci.nsIX509Cert;
+ const nsIX509CertDB = Ci.nsIX509CertDB;
const nsX509CertDB = "@mozilla.org/security/x509certdb;1";
- const nsISSLStatusProvider = Components.interfaces.nsISSLStatusProvider;
- const nsISSLStatus = Components.interfaces.nsISSLStatus;
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+ const nsISSLStatusProvider = Ci.nsISSLStatusProvider;
+ const nsISSLStatus = Ci.nsISSLStatus;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
// We don't have separate info for a frame, return null until further notice
// (see bug 138479)
if (gWindow != gWindow.top)
return null;
var hName = null;
try {
@@ -230,17 +230,17 @@ function setText(id, value)
element.textContent = value;
}
function viewCertHelper(parent, cert)
{
if (!cert)
return;
- var cd = Components.classes[CERTIFICATEDIALOGS_CONTRACTID].getService(nsICertificateDialogs);
+ var cd = Cc[CERTIFICATEDIALOGS_CONTRACTID].getService(nsICertificateDialogs);
cd.viewCert(parent, cert);
}
/**
* Return true iff we have cookies for uri.
*/
function hostHasCookies(aUri) {
var hostName;
@@ -267,18 +267,18 @@ function realmHasPasswords(aUri) {
* Return the number of previous visits recorded for host before today.
*
* @param host - the domain name to look for in history
*/
function previousVisitCount(host, endTimeReference) {
if (!host)
return false;
- var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"]
- .getService(Components.interfaces.nsINavHistoryService);
+ var historyService = Cc["@mozilla.org/browser/nav-history-service;1"]
+ .getService(Ci.nsINavHistoryService);
var options = historyService.getNewQueryOptions();
options.resultType = options.RESULTS_AS_VISIT;
// Search for visits to this host before today
var query = historyService.getNewQuery();
query.endTimeReference = query.TIME_RELATIVE_TODAY;
query.endTime = 0;
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -265,17 +265,17 @@
canvas.height = canvasH;
canvas.parentNode.hidden = false;
var bgColor = this.mPrefs.getBoolPref("browser.display.use_system_colors") ?
"Window" :
this.mPrefs.getCharPref("browser.display.background_color");
if (b.contentDocument instanceof ImageDocument &&
!(b.contentDocument.imageRequest.imageStatus &
- Components.interfaces.imgIRequest.STATUS_ERROR)) {
+ Ci.imgIRequest.STATUS_ERROR)) {
ctx.fillStyle = bgColor;
ctx.fillRect(0, 0, canvasW, canvasH);
var img = b.contentDocument.body.firstChild;
var ratio = img.naturalHeight / img.naturalWidth;
if (img.naturalHeight <= canvasH && img.naturalWidth <= canvasW) {
ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight);
}
else if (ratio * canvasW > canvasH) {
@@ -404,32 +404,32 @@
if (aCallGlobalListeners != false &&
aBrowser == this.mCurrentBrowser) {
this.mProgressListeners.forEach(function (p) {
if (aMethod in p) {
try {
p[aMethod].apply(p, aArguments);
} catch (e) {
// don't inhibit other listeners
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
});
}
if (aCallTabsListeners != false) {
aArguments.unshift(aBrowser);
this.mTabsProgressListeners.forEach(function (p) {
if (aMethod in p) {
try {
p[aMethod].apply(p, aArguments);
} catch (e) {
// don't inhibit other listeners
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
});
}
]]></body>
</method>
<!-- A web progress listener object definition for a given tab. -->
@@ -462,17 +462,17 @@
},
_shouldShowProgress: function (aRequest) {
if (this.mBlank)
return false;
// Don't show progress indicators in tabs for about: URIs
// pointing to local resources.
- if ((aRequest instanceof Components.interfaces.nsIChannel) &&
+ if ((aRequest instanceof Ci.nsIChannel) &&
aRequest.originalURI.schemeIs("about") &&
(aRequest.URI.schemeIs("jar") || aRequest.URI.schemeIs("file")))
return false;
return true;
},
onProgressChange: function (aWebProgress, aRequest,
@@ -501,18 +501,18 @@
},
onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus) {
if (!aRequest)
return;
var oldBlank = this.mBlank;
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
- const nsIChannel = Components.interfaces.nsIChannel;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
+ const nsIChannel = Ci.nsIChannel;
let location, originalLocation;
try {
aRequest.QueryInterface(nsIChannel)
location = aRequest.URI;
originalLocation = aRequest.originalURI;
} catch (ex) {}
if (aStateFlags & nsIWebProgressListener.STATE_START) {
@@ -555,17 +555,17 @@
if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
this.mTab.setAttribute("busy", "true");
// Do the following only for the top frame not any subframes.
if (aWebProgress.isTopLevel) {
// Remove favicon. This shows busy and progress indicators even during a reload.
this.mTab.removeAttribute("image");
- if (!(aWebProgress.loadType & Components.interfaces.nsIDocShell.LOAD_CMD_RELOAD))
+ if (!(aWebProgress.loadType & Ci.nsIDocShell.LOAD_CMD_RELOAD))
this.mTabBrowser.setTabTitleLoading(this.mTab);
}
}
if (this.mTab.selected)
this.mTabBrowser.mIsBusy = true;
}
}
@@ -639,26 +639,26 @@
onLocationChange: function (aWebProgress, aRequest, aLocation, aFlags) {
// OnLocationChange is called for both the top-level content
// and the subframes.
let topLevel = aWebProgress.isTopLevel;
if (topLevel) {
let isSameDocument =
- !!(aFlags & Components.interfaces.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT);
+ !!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT);
// We need to clear the typed value
// if the document failed to load, to make sure the urlbar reflects the
// failed URI (particularly for SSL errors). However, don't clear the value
// if the error page's URI is about:blank, because that causes complete
// loss of urlbar contents for invalid URI errors (see bug 867957).
// Another reason to clear the userTypedValue is if this was an anchor
// navigation initiated by the user.
if (this.mBrowser.didStartLoadSinceLastUserTyping() ||
- ((aFlags & Components.interfaces.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) &&
+ ((aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) &&
aLocation.spec != "about:blank") ||
(isSameDocument && this.mBrowser.inLoadURI))
this.mBrowser.userTypedValue = null;
// Don't clear the favicon if this onLocationChange was
// triggered by a pushState or a replaceState (bug 550565) or
// a hash change (bug 408415).
if (aWebProgress.isLoadingDocument && !isSameDocument)
@@ -697,50 +697,50 @@
if (this.mTabBrowser.mCurrentTab == this.mTab) {
this.mTabBrowser.mProgressListeners.forEach(
function notifyRefreshAttempted(element) {
if (element && "onRefreshAttempted" in element) {
try {
if (!element.onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI))
allowRefresh = false;
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
}
);
}
this.mTabBrowser.mTabsProgressListeners.forEach(
function notifyRefreshAttempted(element) {
if (element && "onRefreshAttempted" in element) {
try {
if (!element.onRefreshAttempted(this.mBrowser, aWebProgress, aURI, aDelay, aSameURI))
allowRefresh = false;
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
}
, this);
return allowRefresh;
},
addFeed: function(aLink)
{
this.mFeeds.push(aLink);
},
QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
- aIID.equals(Components.interfaces.nsIWebProgressListener2) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIWebProgressListener) ||
+ aIID.equals(Ci.nsIWebProgressListener2) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
});
]]>
</body>
</method>
<method name="mInstallSH">
<parameter name="aBrowser"/>
@@ -754,24 +754,24 @@
onProgressChange : function (aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress)
{
},
onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus)
{
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
if ((aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) &&
(aStateFlags & nsIWebProgressListener.STATE_STOP)) {
function refresh(closure) {
closure.mBrowser.webNavigation.sessionHistory = closure.mSH;
closure.mBrowser.webProgress.removeProgressListener(closure);
delete closure.mBrowser._SHListener;
- closure.mSH.QueryInterface(Components.interfaces.nsIWebNavigation)
+ closure.mSH.QueryInterface(Ci.nsIWebNavigation)
.gotoIndex(closure.mSH.index);
}
setTimeout(refresh, 0, this);
}
},
onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags)
{
@@ -782,38 +782,38 @@
},
onSecurityChange : function(aWebProgress, aRequest, aState)
{
},
QueryInterface : function(aIID)
{
- if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIWebProgressListener) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
});
]]>
</body>
</method>
<method name="setIcon">
<parameter name="aTab"/>
<parameter name="aURI"/>
<parameter name="aLoadingPrincipal"/>
<body>
<![CDATA[
let browser = this.getBrowserForTab(aTab);
- browser.mIconURL = aURI instanceof Components.interfaces.nsIURI ? aURI.spec : aURI;
+ browser.mIconURL = aURI instanceof Ci.nsIURI ? aURI.spec : aURI;
if (aURI && this.mFaviconService) {
- if (!(aURI instanceof Components.interfaces.nsIURI))
+ if (!(aURI instanceof Ci.nsIURI))
aURI = makeURI(aURI);
// We do not serialize the principal from within nsSessionStore.js,
// hence if aLoadingPrincipal is null we default to the
// systemPrincipal which will allow the favicon to load.
let loadingPrincipal = aLoadingPrincipal
? aLoadingPrincipal
: Services.scriptSecurityManager.getSystemPrincipal();
@@ -907,17 +907,17 @@
</body>
</method>
<method name="isFailedIcon">
<parameter name="aURI"/>
<body>
<![CDATA[
if (this.mFaviconService) {
- if (!(aURI instanceof Components.interfaces.nsIURI))
+ if (!(aURI instanceof Ci.nsIURI))
aURI = makeURI(aURI);
return this.mFaviconService.isFailedFavicon(aURI);
}
return null;
]]>
</body>
</method>
@@ -973,18 +973,18 @@
if (aURI == "about:blank")
return "";
// We have a URI. Let's try to unescape it using a character set
// in case the URI is not ASCII.
try {
let characterSet = this.mCurrentBrowser.contentDocument.characterSet;
- let textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
- .getService(Components.interfaces.nsITextToSubURI);
+ let textToSubURI = Cc["@mozilla.org/intl/texttosuburi;1"]
+ .getService(Ci.nsITextToSubURI);
aURI = textToSubURI.unEscapeNonAsciiURI(characterSet, aURI);
} catch (e) {
// Do nothing.
}
return aURI;
]]>
</body>
</method>
@@ -1015,17 +1015,17 @@
aFeeds.forEach(
function notifyFeedAvailable(feed) {
element.onFeedAvailable(feed);
}
);
}
}
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
);
]]>
</body>
</method>
<method name="getWindowTitleForBrowser">
@@ -1080,19 +1080,19 @@
</body>
</method>
<method name="updateTitlebar">
<body>
<![CDATA[
var newTitle = this.getWindowTitleForBrowser(this.mCurrentBrowser);
document.title = newTitle;
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIBaseWindow).title = newTitle;
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIBaseWindow).title = newTitle;
]]>
</body>
</method>
<method name="updatePopupMenu">
<parameter name="aPopupMenu"/>
<body>
<![CDATA[
@@ -1149,17 +1149,17 @@
var tabListener = this.mTabListeners[this.tabContainer.selectedIndex];
if (!oldBrowser ||
(!oldBrowser.blockedPopups != !newBrowser.blockedPopups))
this.mCurrentBrowser.updateBlockedPopups();
// Update the URL bar.
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
this.updateUrlBar(newBrowser.webProgress,
null,
newBrowser.currentURI,
0,
newBrowser.securityUI,
newBrowser,
tabListener.mFeeds);
@@ -1280,17 +1280,17 @@
this.mTabListeners[index].addFeed(link);
if (this.browsers[index] == this.mCurrentBrowser) {
this.mProgressListeners.forEach(
function notifyFeedAvailable(element) {
if ("onFeedAvailable" in element) {
try {
element.onFeedAvailable(link);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
}
);
}
]]>
</body>
</method>
@@ -1313,21 +1313,21 @@
this.mSecMan.checkLoadURIWithPrincipal(targetDoc.nodePrincipal, uri,
this.mSecMan.DISALLOW_SCRIPT);
} catch(e) {
return null;
}
}
// Security says okay, now ask content policy
- const nsIContentPolicy = Components.interfaces.nsIContentPolicy;
+ const nsIContentPolicy = Ci.nsIContentPolicy;
try {
var contentPolicy =
- Components.classes['@mozilla.org/layout/content-policy;1']
- .getService(nsIContentPolicy);
+ Cc['@mozilla.org/layout/content-policy;1']
+ .getService(nsIContentPolicy);
} catch (e) {
return null; // Refuse to load if we can't do a security check.
}
if (contentPolicy.shouldLoad(nsIContentPolicy.TYPE_INTERNAL_IMAGE,
uri, targetDoc.documentURIObject,
aLink, aLink.type,
null) != nsIContentPolicy.ACCEPT) {
@@ -1425,17 +1425,17 @@
<parameter name="aReferrerURI"/>
<parameter name="aCharset"/>
<parameter name="aPostData"/>
<parameter name="aLoadInBackground"/>
<parameter name="aAllowThirdPartyFixup"/>
<body>
<![CDATA[
var params = aReferrerURI;
- if (!params || params instanceof Components.interfaces.nsIURI) {
+ if (!params || params instanceof Ci.nsIURI) {
params = {
triggeringPrincipal: Services.scriptSecurityManager
.getSystemPrincipal(),
referrerURI: aReferrerURI,
charset: aCharset,
postData: aPostData,
inBackground: aLoadInBackground,
allowThirdPartyFixup: aAllowThirdPartyFixup,
@@ -1495,20 +1495,20 @@
var firstTabAdded = null;
var targetTabIndex = -1;
if (aReplace) {
let browser;
browser = this.mCurrentBrowser;
targetTabIndex = this.tabContainer.selectedIndex;
- let flags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
+ let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
if (aAllowThirdPartyFixup) {
- flags |= Components.interfaces.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
- Components.interfaces.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
+ Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
}
try {
browser.loadURIWithFlags(aURIs[0], {
flags,
postData: aPostDatas[0],
triggeringPrincipal : aTriggeringPrincipal,
});
} catch (e) {
@@ -1560,17 +1560,17 @@
var aReferrerPolicy;
var aFromExternal;
var aRelatedToCurrent;
var aUserContextId;
var aOpener;
if (arguments.length == 2 &&
arguments[1] != null &&
typeof arguments[1] == "object" &&
- !(arguments[1] instanceof Components.interfaces.nsIURI)) {
+ !(arguments[1] instanceof Ci.nsIURI)) {
let params = arguments[1];
aTriggeringPrincipal = params.triggeringPrincipal;
aReferrerURI = params.referrerURI;
aReferrerPolicy = params.referrerPolicy;
aCharset = params.charset;
aPostData = params.postData;
aFocusNewTab = params.focusNewTab;
aAllowThirdPartyFixup = params.allowThirdPartyFixup;
@@ -1637,29 +1637,29 @@
this.mStrip.collapsed = false;
this.mPrefs.setBoolPref("browser.tabs.forceHide", false);
// wire up a progress listener for the new browser object.
var position = this.tabs.length - 1;
var tabListener = this.mTabProgressListener(t, b, blank);
- const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
- .createInstance(Components.interfaces.nsIWebProgress);
- filter.addProgressListener(tabListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
- b.webProgress.addProgressListener(filter, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
+ const filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
+ .createInstance(Ci.nsIWebProgress);
+ filter.addProgressListener(tabListener, Ci.nsIWebProgress.NOTIFY_ALL);
+ b.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
this.mTabListeners[position] = tabListener;
this.mTabFilters[position] = filter;
if (!blank) {
// pretend the user typed this so it'll be available till
// the document successfully loads
b.userTypedValue = aURI;
- let nsIWebNavigation = Components.interfaces.nsIWebNavigation;
+ let nsIWebNavigation = Ci.nsIWebNavigation;
let flags = nsIWebNavigation.LOAD_FLAGS_NONE;
if (aAllowThirdPartyFixup)
flags = nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
if (aFromExternal)
flags |= nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
try {
b.loadURIWithFlags(aURI, {
@@ -1714,18 +1714,18 @@
var numTabs = this.tabs.length;
if (numTabs > 1) {
const closeOtherTabsPref = "browser.tabs.warnOnCloseOther";
var shouldPrompt = this.mPrefs.getBoolPref(closeOtherTabsPref);
var reallyClose = true;
if (shouldPrompt) {
- var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
+ var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Ci.nsIPromptService);
//default to true: if it were false, we wouldn't get this far
var warnOnClose = { value:true };
var bundle = this.mStringBundle;
var tabsToClose = numTabs - 1; //number of tabs to be removed
var buttonPressed = promptService.confirmEx(window,
bundle.getString('tabs.closeWarningTitle'),
@@ -1825,24 +1825,24 @@
// reattach the old history
b.webNavigation.sessionHistory = hist;
// Hook up the title change listener again
b.addEventListener("DOMTitleChanged", this.onTitleChanged, true);
// add back the filters, security first (bug 313335)
- const nsIWebProgress = Components.interfaces.nsIWebProgress;
+ const nsIWebProgress = Ci.nsIWebProgress;
var secFlags = nsIWebProgress.NOTIFY_STATE_ALL | nsIWebProgress.NOTIFY_LOCATION | nsIWebProgress.NOTIFY_SECURITY;
b.webProgress.addProgressListener(b.securityUI, secFlags);
var position = this.tabs.length - 1;
var tabListener = this.mTabProgressListener(t, b, false);
- const filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
- .createInstance(nsIWebProgress);
+ const filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
+ .createInstance(nsIWebProgress);
filter.addProgressListener(tabListener, nsIWebProgress.NOTIFY_ALL);
b.webProgress.addProgressListener(filter, nsIWebProgress.NOTIFY_ALL);
this.mTabListeners[position] = tabListener;
this.mTabFilters[position] = filter;
t.dispatchEvent(new Event("TabOpen",
{ bubbles: true, cancelable: false }));
@@ -2005,21 +2005,21 @@
tabData.browserData = {
tab: aTab,
browser: oldBrowser,
history: oldSH,
toJSON: function() {} // hides this object from JSON.stringify
};
this.savedBrowsers.unshift(tabData);
- var newSH = Components.classes["@mozilla.org/browser/shistory;1"]
- .createInstance(Components.interfaces.nsISHistoryInternal);
+ var newSH = Cc["@mozilla.org/browser/shistory;1"]
+ .createInstance(Ci.nsISHistoryInternal);
oldBrowser.webNavigation.sessionHistory = newSH;
var entry = oldSH.getEntryAtIndex(oldSH.index, false)
- .QueryInterface(Components.interfaces.nsISHEntry)
+ .QueryInterface(Ci.nsISHEntry)
.clone();
// The bfcache entry is tightly coupled to the original shistory it
// belongs to, better to drop it.
entry.abandonBFCacheEntry();
// don't try to repost data when restoring the tab
entry.postData = null;
newSH.addEntry(entry, true);
@@ -2092,33 +2092,33 @@
</body>
</method>
<method name="addProgressListener">
<parameter name="aListener"/>
<body>
<![CDATA[
if (!aListener)
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
if (this.mProgressListeners.indexOf(aListener) != -1)
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
// push() does not disturb possibly ongoing iterations.
this.mProgressListeners.push(aListener);
]]>
</body>
</method>
<method name="removeProgressListener">
<parameter name="aListener"/>
<body>
<![CDATA[
if (this.mProgressListeners.indexOf(aListener) == -1)
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
// Create a new array, not to disturb possibly ongoing iterations.
this.mProgressListeners =
this.mProgressListeners.filter(
function removeListener(element) {
return element != aListener;
}
);
@@ -2126,33 +2126,33 @@
</body>
</method>
<method name="addTabsProgressListener">
<parameter name="aListener"/>
<body>
<![CDATA[
if (!aListener)
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
if (this.mTabsProgressListeners.indexOf(aListener) != -1)
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
// push() does not disturb possibly ongoing iterations.
this.mTabsProgressListeners.push(aListener);
]]>
</body>
</method>
<method name="removeTabsProgressListener">
<parameter name="aListener"/>
<body>
<![CDATA[
if (this.mTabsProgressListeners.indexOf(aListener) == -1)
- throw Components.results.NS_ERROR_FAILURE;
+ throw Cr.NS_ERROR_FAILURE;
// Create a new array, not to disturb possibly ongoing iterations.
this.mTabsProgressListeners =
this.mTabsProgressListeners.filter(
function removeListener(element) {
return element != aListener;
}
);
@@ -2214,17 +2214,17 @@
<method name="getTabIndex">
<parameter name="aTab"/>
<body>
<![CDATA[
for (var i = 0; i < this.tabs.length; ++i)
if (this.tabs[i] == aTab)
return i;
- throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+ throw Cr.NS_ERROR_ILLEGAL_VALUE;
]]>
</body>
</method>
<method name="selectTabAtIndex">
<parameter name="aIndex"/>
<parameter name="aEvent"/>
<body>
@@ -2395,18 +2395,18 @@
tabIndex = this.getTabIndex(draggedTab);
if (newIndex > tabIndex)
newIndex--;
this.moveTabTo(tabIndex, newIndex);
return;
}
var url;
- var linkHandler = Components.classes["@mozilla.org/content/dropped-link-handler;1"]
- .getService(Components.interfaces.nsIDroppedLinkHandler);
+ var linkHandler = Cc["@mozilla.org/content/dropped-link-handler;1"]
+ .getService(Ci.nsIDroppedLinkHandler);
try {
// Pass true to disallow dropping javascript: or data: urls.
url = linkHandler.dropLink(aEvent, {}, true);
} catch (ex) {}
// Valid urls don't contain spaces ' '; if we have a space
// it isn't a valid url.
if (!url || url.indexOf(" ") != -1)
@@ -2646,17 +2646,17 @@
var data = aGroup[i];
if ("sessionHistory" in data) {
this.addTab("about:blank", null);
var browser = this.tabContainer.lastChild.linkedBrowser;
// need to hold on to the listener so it won't go away
// addProgressListener only has a weak pointer to it
browser._SHListener =
this.mInstallSH(browser, aGroup[i].sessionHistory);
- browser.webProgress.addProgressListener(browser._SHListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
+ browser.webProgress.addProgressListener(browser._SHListener, Ci.nsIWebProgress.NOTIFY_ALL);
} else {
var referrerURI = "referrerURI" in data ? data.referrerURI : null;
this.addTab(data.URI, referrerURI);
}
}
if (i < oldCount) {
var firstTab = this.tabContainer.firstChild;
var browserData = {
@@ -3053,18 +3053,18 @@
</body>
</method>
<field name="_fastFind">null</field>
<property name="fastFind" readonly="true">
<getter>
<![CDATA[
if (!this._fastFind) {
- this._fastFind = Components.classes["@mozilla.org/typeaheadfind;1"]
- .createInstance(Components.interfaces.nsITypeAheadFind);
+ this._fastFind = Cc["@mozilla.org/typeaheadfind;1"]
+ .createInstance(Ci.nsITypeAheadFind);
this._fastFind.init(this.docShell);
}
return this._fastFind;
]]>
</getter>
</property>
<field name="_lastSearchString">null</field>
@@ -3091,22 +3091,22 @@
// Ensure the browser's session history and security UI are wired up
// note that toolkit browser automatically inits its security UI
// when you get it but for xpfe you need to init it explicitly
if (!this.mCurrentBrowser.securityUI)
this.mCurrentBrowser.init();
// Wire up the tab's progress listener and filter.
- const nsIWebProgress = Components.interfaces.nsIWebProgress;
+ const nsIWebProgress = Ci.nsIWebProgress;
var tabListener = this.mTabProgressListener(this.mCurrentTab,
this.mCurrentBrowser,
false);
- var filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
- .createInstance(nsIWebProgress);
+ var filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
+ .createInstance(nsIWebProgress);
filter.addProgressListener(tabListener, nsIWebProgress.NOTIFY_ALL);
this.webProgress.addProgressListener(filter,
nsIWebProgress.NOTIFY_ALL);
this.mTabListeners[0] = tabListener;
this.mTabFilters[0] = filter;
if (!this.mPrefs.getBoolPref("browser.tabs.autoHide") &&
!this.mPrefs.getBoolPref("browser.tabs.forceHide") &&
@@ -3120,18 +3120,18 @@
t.style.maxWidth = this.mPrefs.getIntPref("browser.tabs.tabMaxWidth") + "px";
t.style.minWidth = this.mPrefs.getIntPref("browser.tabs.tabMinWidth") + "px";
t.width = 0;
t.flex = 100;
t.setAttribute("validate", "never");
t.setAttribute("onerror", "this.parentNode.parentNode.parentNode.parentNode.addToMissedIconCache(this.getAttribute('image')); this.removeAttribute('image');");
this.referenceTab = t;
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.addObserver(this, "browser:purge-session-history");
this.mPrefs.addObserver("browser.tabs.max_tabs_undo", this);
var onclick = this.getAttribute("oncontentclick");
if (onclick)
this.onContentClick = new Function("event", onclick);
]]>
</constructor>
@@ -3146,18 +3146,18 @@
for (var i = 0; i < this.mTabListeners.length; ++i) {
this.browsers[i].webProgress.removeProgressListener(this.mTabFilters[i]);
this.mTabFilters[i].removeProgressListener(this.mTabListeners[i]);
this.mTabFilters[i] = null;
this.mTabListeners[i] = null;
// eventListeners are removed from the browsers in display order of the browsers
this.browsers[i].removeEventListener("DOMTitleChanged", this.onTitleChanged, true);
}
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.removeObserver(this, "browser:purge-session-history");
this.mPrefs.removeObserver("browser.tabs.max_tabs_undo", this);
this.savedBrowsers.forEach(function(aTabData) {
delete aTabData.browserData;
});
]]>
</destructor>
--- a/suite/browser/test/browser/browser_bug409624.js
+++ b/suite/browser/test/browser/browser_bug409624.js
@@ -14,18 +14,18 @@ function test() {
do_throw("Error occurred updating form history: " + error);
},
handleCompletion: function (reason) { if (!reason) test2(); },
});
}
function test2()
{
- let prefService = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+ let prefService = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch);
let findBar = document.getElementById("FindToolbar");
let textbox = findBar.getElement("findbar-textbox");
let temp = {};
ChromeUtils.import("resource:///modules/Sanitizer.jsm", temp);
let s = temp.Sanitizer;
let prefBranch = prefService.getBranch("privacy.item.");
--- a/suite/browser/test/browser/browser_bug413915.js
+++ b/suite/browser/test/browser/browser_bug413915.js
@@ -1,14 +1,14 @@
function test() {
- var ioserv = Components.classes["@mozilla.org/network/io-service;1"].
- getService(Components.interfaces.nsIIOService);
+ var ioserv = Cc["@mozilla.org/network/io-service;1"].
+ getService(Ci.nsIIOService);
var exampleUri = ioserv.newURI("http://example.com/");
- var secman = Components.classes["@mozilla.org/scriptsecuritymanager;1"].
- getService(Components.interfaces.nsIScriptSecurityManager);
+ var secman = Cc["@mozilla.org/scriptsecuritymanager;1"].
+ getService(Ci.nsIScriptSecurityManager);
var principal = secman.createCodebasePrincipal(exampleUri, {});
function testIsFeed(aTitle, aHref, aType, aKnown) {
var link = { title: aTitle, href: aHref, type: aType };
return isValidFeed(link, principal, aKnown);
}
var href = "http://example.com/feed/";
--- a/suite/browser/test/browser/browser_bug623155.js
+++ b/suite/browser/test/browser/browser_bug623155.js
@@ -48,27 +48,27 @@ var gNewTab;
function test() {
waitForExplicitFinish();
// Load a URI in the background.
gNewTab = gBrowser.addTab(REDIRECT_FROM + "#BG");
gBrowser.getBrowserForTab(gNewTab)
.webProgress
.addProgressListener(gWebProgressListener,
- Components.interfaces.nsIWebProgress
- .NOTIFY_LOCATION);
+ Ci.nsIWebProgress
+ .NOTIFY_LOCATION);
}
var gWebProgressListener = {
QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIWebProgressListener) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
// ---------------------------------------------------------------------------
// NOTIFY_LOCATION mode should work fine without these methods.
//
//onStateChange: function() {},
//onStatusChange: function() {},
//onProgressChange: function() {},
--- a/suite/browser/test/browser/browser_fayt.js
+++ b/suite/browser/test/browser/browser_fayt.js
@@ -8,18 +8,18 @@ function test() {
gBrowser.getBrowserForTab(tab2).addEventListener("load", runTest, true);
waitForExplicitFinish();
function runTest() {
gBrowser.getBrowserForTab(tab2).removeEventListener("load", runTest, true);
gBrowser.selectedTab = tab2;
- is(gBrowser.fastFind.find("random", false), Components.interfaces.nsITypeAheadFind.FIND_FOUND, "FAYT found the random text");
+ is(gBrowser.fastFind.find("random", false), Ci.nsITypeAheadFind.FIND_FOUND, "FAYT found the random text");
gBrowser.selectedTab = tab1;
- is(gBrowser.fastFind.find("dummy", false), Components.interfaces.nsITypeAheadFind.FIND_FOUND, "FAYT found the dummy text");
+ is(gBrowser.fastFind.find("dummy", false), Ci.nsITypeAheadFind.FIND_FOUND, "FAYT found the dummy text");
gBrowser.removeTab(tab2);
gBrowser.removeTab(tab1);
finish();
}
}
--- a/suite/browser/test/browser/browser_pluginCrashCommentAndURL.js
+++ b/suite/browser/test/browser/browser_pluginCrashCommentAndURL.js
@@ -140,17 +140,17 @@ function onSubmitStatus(subj, topic, dat
doNextRun();
}
function getPropertyBagValue(bag, key) {
try {
var val = bag.getProperty(key);
}
catch (e) {
- if (e.result != Components.results.NS_ERROR_FAILURE) {
+ if (e.result != Cr.NS_ERROR_FAILURE) {
throw e;
}
}
return val;
}
function failWithException(err) {
ok(false, "Uncaught exception: " + err + "\n" + err.stack);
--- a/suite/browser/test/browser/browser_pluginnotification.js
+++ b/suite/browser/test/browser/browser_pluginnotification.js
@@ -1,17 +1,17 @@
var rootDir = getRootDirectory(gTestPath);
const gTestRoot = rootDir;
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
var gTestBrowser = null;
var gNextTest = null;
var gClickToPlayPluginActualEvents = 0;
var gClickToPlayPluginExpectedEvents = 5;
-var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
+var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
ChromeUtils.import("resource://gre/modules/Services.jsm");
// This listens for the next opened tab and checks it is of the right url.
// opencallback is called when the new tab is fully loaded
// closecallback is called when the tab is closed
function TabOpenListener(url, opencallback, closecallback) {
this.url = url;
--- a/suite/browser/test/browser/browser_pluginplaypreview.js
+++ b/suite/browser/test/browser/browser_pluginplaypreview.js
@@ -12,114 +12,114 @@ var gPlayPreviewPluginActualEvents = 0;
var gPlayPreviewPluginExpectedEvents = 1;
var gPlayPreviewRegistration = null;
function registerPlayPreview(mimeType, targetUrl) {
function StreamConverterFactory() {}
StreamConverterFactory.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIFactory]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]),
_targetConstructor: null,
register: function register(targetConstructor) {
this._targetConstructor = targetConstructor;
var proto = targetConstructor.prototype;
- var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
+ var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
registrar.registerFactory(proto.classID, proto.classDescription,
proto.contractID, this);
},
unregister: function unregister() {
var proto = this._targetConstructor.prototype;
- var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
+ var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
registrar.unregisterFactory(proto.classID, this);
this._targetConstructor = null;
},
// nsIFactory
createInstance: function createInstance(aOuter, iid) {
if (aOuter !== null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return (new (this._targetConstructor)).QueryInterface(iid);
},
// nsIFactory
lockFactory: function lockFactory(lock) {
// No longer used as of gecko 1.7.
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
}
};
function OverlayStreamConverter() {}
OverlayStreamConverter.prototype = {
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsISupports,
- Components.interfaces.nsIStreamConverter,
- Components.interfaces.nsIStreamListener,
- Components.interfaces.nsIRequestObserver
+ Ci.nsISupports,
+ Ci.nsIStreamConverter,
+ Ci.nsIStreamListener,
+ Ci.nsIRequestObserver
]),
classID: Components.ID('{4c6030f7-e20a-264f-0f9b-ada3a9e97384}'),
classDescription: 'overlay-test-data Component',
contractID: '@mozilla.org/streamconv;1?from=application/x-moz-playpreview&to=*/*',
// nsIStreamConverter::convert
convert: function(aFromStream, aFromType, aToType, aCtxt) {
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
// nsIStreamConverter::asyncConvertData
asyncConvertData: function(aFromType, aToType, aListener, aCtxt) {
var isValidRequest = false;
try {
var request = aCtxt;
- request.QueryInterface(Components.interfaces.nsIChannel);
+ request.QueryInterface(Ci.nsIChannel);
var spec = request.URI.spec;
var expectedSpec = 'data:application/x-moz-playpreview;,' + mimeType;
isValidRequest = (spec == expectedSpec);
} catch (e) { }
if (!isValidRequest)
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
// Store the listener passed to us
this.listener = aListener;
},
// nsIStreamListener::onDataAvailable
onDataAvailable: function(aRequest, aContext, aInputStream, aOffset, aCount) {
// Do nothing since all the data loading is handled by the viewer.
ok(false, "onDataAvailable should not be called");
},
// nsIRequestObserver::onStartRequest
onStartRequest: function(aRequest, aContext) {
// Setup the request so we can use it below.
- aRequest.QueryInterface(Components.interfaces.nsIChannel);
+ aRequest.QueryInterface(Ci.nsIChannel);
// Cancel the request so the viewer can handle it.
- aRequest.cancel(Components.results.NS_BINDING_ABORTED);
+ aRequest.cancel(Cr.NS_BINDING_ABORTED);
// Create a new channel that is viewer loaded as a resource.
var ioService = Services.io;
var channel = ios.newChannel2(targetUrl, null, null, null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
channel.asyncOpen2(this.listener);
},
// nsIRequestObserver::onStopRequest
onStopRequest: function(aRequest, aContext, aStatusCode) {
// Do nothing.
}
};
- var ph = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
+ var ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
ph.registerPlayPreviewMimeType(mimeType);
var factory = new StreamConverterFactory();
factory.register(OverlayStreamConverter);
return (gPlayPreviewRegistration = {
unregister: function() {
ph.unregisterPlayPreviewMimeType(mimeType);
@@ -194,18 +194,18 @@ function test1a() {
ok(!notificationBox.getNotificationWithValue("missing-plugins"), "Test 1a, Should not have displayed the missing plugin notification");
ok(!notificationBox.getNotificationWithValue("blocked-plugins"), "Test 1a, Should not have displayed the blocked plugin notification");
var pluginInfo = getTestPlugin();
ok(pluginInfo, "Should have a test plugin");
var doc = gTestBrowser.contentDocument;
var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Components.interfaces.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 1a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
+ var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
+ is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 1a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
ok(!objLoadingContent.activated, "Test 1a, Plugin should not be activated");
var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
ok(overlay, "Test 1a, the overlay div is expected");
var iframe = overlay.getElementsByClassName("previewPluginContentFrame")[0];
ok(iframe && iframe.localName == "iframe", "Test 1a, the overlay iframe is expected");
var iframeHref = iframe.contentWindow.location.href;
@@ -220,98 +220,98 @@ function test1a() {
overlay.dispatchEvent(e);
var condition = () => objLoadingContent.activated;
waitForCondition(condition, test1b, "Test 1a, Waited too long for plugin to stop play preview");
}
// Tests that activating via MozPlayPlugin through the notification works (part 2/2)
function test1b() {
var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent);
+ var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "Test 1b, Plugin should be activated");
is(gPlayPreviewPluginActualEvents, gPlayPreviewPluginExpectedEvents,
"There should be exactly one PluginPlayPreview event");
unregisterPlayPreview();
prepareTest(test2, gTestRoot + "plugin_test.html");
}
// Tests a page with a working plugin in it -- the mime type was just unregistered.
function test2() {
var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent);
+ var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "Test 2, Plugin should be activated");
registerPlayPreview('application/x-unknown', 'about:');
prepareTest(test3, gTestRoot + "plugin_test.html");
}
// Tests a page with a working plugin in it -- diffent play preview type is reserved.
function test3() {
var plugin = gTestBrowser.contentDocument.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent);
+ var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "Test 3, Plugin should be activated");
unregisterPlayPreview();
registerPlayPreview('application/x-test', 'about:');
Services.prefs.setBoolPref("plugins.click_to_play", true);
prepareTest(test4a, gTestRoot + "plugin_test.html", 1);
}
// Test a fallback to the click-to-play
function test4a() {
var doc = gTestBrowser.contentDocument;
var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Components.interfaces.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 4a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
+ var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
+ is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 4a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
ok(!objLoadingContent.activated, "Test 4a, Plugin should not be activated");
var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
ok(overlay, "Test 4a, the overlay div is expected");
var e = overlay.ownerDocument.createEvent("CustomEvent");
e.initCustomEvent("MozPlayPlugin", true, true, true);
overlay.dispatchEvent(e);
- var condition = () => objLoadingContent.pluginFallbackType == Components.interfaces.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY;
+ var condition = () => objLoadingContent.pluginFallbackType == Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY;
waitForCondition(condition, test4b, "Test 4a, Waited too long for plugin to stop play preview");
}
function test4b() {
var doc = gTestBrowser.contentDocument;
var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent);
- ok(objLoadingContent.pluginFallbackType != Components.interfaces.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 4b, plugin fallback type should not be PLUGIN_PLAY_PREVIEW");
+ var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
+ ok(objLoadingContent.pluginFallbackType != Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 4b, plugin fallback type should not be PLUGIN_PLAY_PREVIEW");
ok(!objLoadingContent.activated, "Test 4b, Plugin should not be activated");
prepareTest(test5a, gTestRoot + "plugin_test.html", 1);
}
// Test a bypass of the click-to-play
function test5a() {
var doc = gTestBrowser.contentDocument;
var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent);
- is(objLoadingContent.pluginFallbackType, Components.interfaces.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 5a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
+ var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
+ is(objLoadingContent.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW, "Test 5a, plugin fallback type should be PLUGIN_PLAY_PREVIEW");
ok(!objLoadingContent.activated, "Test 5a, Plugin should not be activated");
var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "previewPluginContent");
ok(overlay, "Test 5a, the overlay div is expected");
var e = overlay.ownerDocument.createEvent("CustomEvent");
e.initCustomEvent("MozPlayPlugin", true, true, false);
overlay.dispatchEvent(e);
var condition = () => objLoadingContent.activated;
waitForCondition(condition, test5b, "Test 5a, Waited too long for plugin to stop play preview");
}
function test5b() {
var doc = gTestBrowser.contentDocument;
var plugin = doc.getElementById("test");
- var objLoadingContent = plugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent);
+ var objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "Test 5b, Plugin should be activated");
finishTest();
}
--- a/suite/browser/test/browser/head.js
+++ b/suite/browser/test/browser/head.js
@@ -9,18 +9,18 @@ function findChromeWindowByURI(aURI) {
if (win.location.href == aURI)
return win;
}
return null;
}
function getTestPlugin(aName) {
var pluginName = aName || "Test Plug-in";
- var ph = Components.classes["@mozilla.org/plugin/host;1"]
- .getService(Components.interfaces.nsIPluginHost);
+ var ph = Cc["@mozilla.org/plugin/host;1"]
+ .getService(Ci.nsIPluginHost);
var tags = ph.getPluginTags();
// Find the test plugin
for (var i = 0; i < tags.length; i++) {
if (tags[i].name == pluginName)
return tags[i];
}
@@ -51,18 +51,18 @@ function whenNewWindowLoaded(aOptions, a
"about:blank");
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad);
aCallback(win);
});
}
function updateBlocklist(aCallback) {
- var blocklistNotifier = Components.classes["@mozilla.org/extensions/blocklist;1"]
- .getService(Components.interfaces.nsITimerCallback);
+ var blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
+ .getService(Ci.nsITimerCallback);
var observer = function() {
Services.obs.removeObserver(observer, "blocklist-updated");
SimpleTest.executeSoon(aCallback);
};
Services.obs.addObserver(observer, "blocklist-updated");
blocklistNotifier.notify(null);
}
--- a/suite/browser/test/mochitest/feed_discovery.html
+++ b/suite/browser/test/mochitest/feed_discovery.html
@@ -69,22 +69,22 @@ https://bugzilla.mozilla.org/show_bug.cg
<body>
<script type="text/javascript">
window.onload = function() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var tests = new Array();
var currentWindow =
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
var browserSH = currentWindow.XULBrowserWindow;
var discovered = browserSH.feeds;
tests.push({ check: discovered.length > 0,
message: "some feeds should be discovered" });
var feeds = [];
--- a/suite/browser/urlbarBindings.xml
+++ b/suite/browser/urlbarBindings.xml
@@ -158,18 +158,18 @@
var [, preDomain, domain] = matchedURL;
var subDomain = "";
// getBaseDomainFromHost doesn't recognize IPv6 literals in brackets as IPs (bug 667159)
if (domain[0] != "[") {
try {
var baseDomain = Services.eTLD.getBaseDomainFromHost(domain);
if (!domain.endsWith(baseDomain)) {
// getBaseDomainFromHost converts its resultant to ACE.
- let IDNService = Components.classes["@mozilla.org/network/idn-service;1"]
- .getService(Components.interfaces.nsIIDNService);
+ let IDNService = Cc["@mozilla.org/network/idn-service;1"]
+ .getService(Ci.nsIIDNService);
baseDomain = IDNService.convertACEtoUTF8(baseDomain);
}
if (baseDomain != domain) {
subDomain = domain.slice(0, -baseDomain.length);
}
} catch (e) {}
}
@@ -288,19 +288,19 @@
switch (aCommand) {
case "cmd_copy":
case "cmd_cut":
var val = this._getSelectedValueForClipboard();
var controller = this._editItemsController;
if (!val || !controller.isCommandEnabled(aCommand))
return;
- Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper)
- .copyString(val);
+ Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper)
+ .copyString(val);
if (aCommand == "cmd_cut")
goDoCommand("cmd_delete");
break;
case "cmd_pasteAndGo":
this.select();
goDoCommand("cmd_paste");
@@ -556,19 +556,19 @@
</binding>
<binding id="autocomplete-search-box">
<content orient="vertical"/>
<implementation>
<constructor><![CDATA[
this.navigatorBundle =
- Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle("chrome://navigator/locale/navigator.properties");
+ Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle("chrome://navigator/locale/navigator.properties");
var text = this.getAttribute("searchvalue");
if (text)
this.searchValue = text;
]]></constructor>
<field name="mSelectedIndex">
-1
--- a/suite/common/aboutPrivateBrowsing.js
+++ b/suite/common/aboutPrivateBrowsing.js
@@ -1,16 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
window.onload = function () {
- if (window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsILoadContext)
+ if (window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsILoadContext)
.usePrivateBrowsing) {
document.getElementById("warningBox").className = "private";
document.title = document.getElementById("privateTitle").textContent;
}
else {
document.getElementById("warningBox").className = "normal";
document.title = document.getElementById("normalTitle").textContent;
}
--- a/suite/common/aboutSessionRestore.js
+++ b/suite/common/aboutSessionRestore.js
@@ -20,17 +20,17 @@ window.onload = function() {
document.getElementById("errorCancel")
.addEventListener("command", startNewSession);
// the crashed session state is kept inside a textbox so that SessionStore picks it up
// (for when the tab is closed or the session crashes right again)
var sessionData = document.getElementById("sessionData");
if (!sessionData.value) {
- var ss = Components.classes["@mozilla.org/suite/sessionstartup;1"].getService(Components.interfaces.nsISessionStartup);
+ var ss = Cc["@mozilla.org/suite/sessionstartup;1"].getService(Ci.nsISessionStartup);
sessionData.value = ss.state;
if (!sessionData.value) {
document.getElementById("errorTryAgain").disabled = true;
return;
}
}
// make sure the data is tracked to be restored in case of a subsequent crash
sessionData.dispatchEvent(new UIEvent("input",
@@ -94,17 +94,17 @@ function restoreSession() {
else if (!gTreeData[t].checked)
// this window won't be restored at all
gStateObject.windows.splice(ix, 1);
ix--;
}
}
var stateString = JSON.stringify(gStateObject);
- var ss = Components.classes["@mozilla.org/suite/sessionstore;1"].getService(Components.interfaces.nsISessionStore);
+ var ss = Cc["@mozilla.org/suite/sessionstore;1"].getService(Ci.nsISessionStore);
var top = getBrowserWindow();
// if there's only this page open, reuse the window for restoring the session
if (top.gBrowser.tabContainer.childNodes.length == 1) {
ss.setWindowState(top, stateString, true);
return;
}
@@ -155,19 +155,19 @@ function onListKeyDown(aEvent) {
restoreSingleTab(ix, aEvent.shiftKey);
break;
}
}
// Helper functions
function getBrowserWindow() {
- return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem).rootTreeItem
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);
+ return window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem).rootTreeItem
+ .QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
}
function toggleRowChecked(aIx) {
var item = gTreeData[aIx];
item.checked = !item.checked;
treeView.treeBox.invalidateRow(aIx);
function isChecked(aItem) {
@@ -191,17 +191,17 @@ function toggleRowChecked(aIx) {
document.getElementById("errorTryAgain").disabled = !gTreeData.some(isChecked);
}
function restoreSingleTab(aIx, aShifted) {
var tabbrowser = getBrowserWindow().gBrowser;
var newTab = tabbrowser.addTab();
var item = gTreeData[aIx];
- var ss = Components.classes["@mozilla.org/suite/sessionstore;1"].getService(Components.interfaces.nsISessionStore);
+ var ss = Cc["@mozilla.org/suite/sessionstore;1"].getService(Ci.nsISessionStore);
var tabState = gStateObject.windows[item.parent.ix]
.tabs[aIx - gTreeData.indexOf(item.parent) - 1];
ss.setTabState(newTab, JSON.stringify(tabState));
// respect the preference as to whether to select the tab (the Shift key inverses)
if (Services.prefs.getBoolPref("browser.tabs.loadInBackground") != !aShifted)
tabbrowser.selectedTab = newTab;
}
--- a/suite/common/autocomplete/autocomplete.xml
+++ b/suite/common/autocomplete/autocomplete.xml
@@ -230,17 +230,17 @@
<body><![CDATA[
var list = this.getAttribute("autocompletesearch").split(" ");
for (var i = 0; i < list.length; i++) {
var name = list[i];
var contractid = "@mozilla.org/autocomplete/search;1?name=" + name;
if (contractid in Components.classes) {
try {
this.mSessions[name] =
- Components.classes[contractid].getService(Components.interfaces.nsIAutoCompleteSearch);
+ Cc[contractid].getService(Ci.nsIAutoCompleteSearch);
this.mLastResults[name] = null;
this.mLastRows[name] = 0;
++this.sessionCount;
} catch (e) {
dump("### ERROR - unable to create search \"" + name + "\".\n");
}
} else {
dump("search \"" + name + "\" not found - skipping.\n");
@@ -325,17 +325,17 @@
<field name="oninit">null</field>
<field name="mDefaultMatchFilled">false</field>
<field name="mFirstReturn">true</field>
<field name="mIsPasting">false</field>
<field name="mPasteController"><![CDATA[
({
self: this,
- kGlobalClipboard: Components.interfaces.nsIClipboard.kGlobalClipboard,
+ kGlobalClipboard: Ci.nsIClipboard.kGlobalClipboard,
supportsCommand: function(aCommand) {
return aCommand == "cmd_paste";
},
isCommandEnabled: function(aCommand) {
return aCommand == "cmd_paste" &&
this.self.editor.isSelectionEditable &&
this.self.editor.canPaste(this.kGlobalClipboard);
},
@@ -376,18 +376,18 @@
})
]]></field>
<field name="mInputElt"><![CDATA[
document.getAnonymousElementByAttribute(this, "anonid", "input");
]]></field>
<field name="mMenuAccessKey"><![CDATA[
- Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch)
+ Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch)
.getIntPref("ui.key.menuAccessKey");
]]></field>
<!-- =================== PUBLIC METHODS =================== -->
<method name="getErrorAt">
<parameter name="aIndex"/>
<body><![CDATA[
@@ -516,17 +516,17 @@
<!-- -->
<method name="processResults">
<parameter name="aSessionName"/>
<parameter name="aResults"/>
<body><![CDATA[
if (this.disableAutoComplete)
return;
- const ACR = Components.interfaces.nsIAutoCompleteResult;
+ const ACR = Ci.nsIAutoCompleteResult;
var status = aResults.searchResult;
if (status != ACR.RESULT_NOMATCH_ONGOING &&
status != ACR.RESULT_SUCCESS_ONGOING)
--this.mSessionReturns;
// check the many criteria for failure
if (aResults.errorDescription)
++this.mFailureItems;
@@ -1492,19 +1492,19 @@
if (!this.input) {
this.tree.view = aInput.controller;
this.view = this.tree.view;
this.showCommentColumn = aInput.showCommentColumn;
this.maxRows = aInput.maxRows;
this.invalidate();
var viewer = aElement.ownerGlobal
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
.contentViewer;
var rect = aElement.getBoundingClientRect();
var width = Math.round((rect.right - rect.left) * viewer.fullZoom);
this.setAttribute("width", width > 100 ? width : 100);
// Adjust the direction (which is not inherited) of the autocomplete
// popup list, based on the textbox direction. (Bug 707039)
this.style.direction = aElement.ownerGlobal
.getComputedStyle(aElement)
--- a/suite/common/bindings/findbar.xml
+++ b/suite/common/bindings/findbar.xml
@@ -22,18 +22,18 @@
<bindings id="findbarBindings"
xmlns="http://www.mozilla.org/xbl">
<binding id="findbar"
extends="chrome://global/content/bindings/findbar.xml#findbar">
<implementation>
<constructor><![CDATA[
var prefsvc =
- Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+ Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch);
prefsvc.removeObserver("accessibility.typeaheadfind",
this._observer);
prefsvc.addObserver("accessibility.typeaheadfind.autostart",
this._suiteObserver);
prefsvc.addObserver("accessibility.typeaheadfind.usefindbar",
this._suiteObserver);
@@ -42,30 +42,30 @@
this._useFindbar =
prefsvc.getBoolPref("accessibility.typeaheadfind.usefindbar");
]]></constructor>
<field name="_suiteObserver"><![CDATA[({
_self: this,
QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIObserver) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIObserver) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
observe: function(aSubject, aTopic, aPrefName) {
if (aTopic != "nsPref:changed")
return;
var prefsvc =
- aSubject.QueryInterface(Components.interfaces.nsIPrefBranch);
+ aSubject.QueryInterface(Ci.nsIPrefBranch);
switch (aPrefName) {
case "accessibility.typeaheadfind.autostart":
this._self._findAsYouType = prefsvc.getBoolPref(aPrefName);
this._self._updateBrowserWithState();
break;
case "accessibility.typeaheadfind.usefindbar":
this._self._useFindbar = prefsvc.getBoolPref(aPrefName);
@@ -81,18 +81,18 @@
<body><![CDATA[
if (this._destroyed)
return;
this._destroyed = true;
this.browser = null;
var prefsvc =
- Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+ Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch);
prefsvc.removeObserver("accessibility.typeaheadfind.linksonly",
this._observer);
prefsvc.removeObserver("accessibility.typeaheadfind.casesensitive",
this._observer);
prefsvc.removeObserver("findbar.entireword", this._observer);
prefsvc.removeObserver("findbar.highlightAll", this._observer);
prefsvc.removeObserver("findbar.modalHighlight", this._observer);
--- a/suite/common/bindings/notification.xml
+++ b/suite/common/bindings/notification.xml
@@ -16,41 +16,41 @@
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="browser-notificationbox"
extends="chrome://global/content/bindings/notification.xml#notificationbox">
<implementation implements="nsIObserver, nsIFormSubmitObserver, nsIWebProgressListener, nsIWebProgressListener2, nsIDOMEventListener">
<field name="_stringBundle" readonly="true">
<![CDATA[
- Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle("chrome://communicator/locale/notification.properties");
+ Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle("chrome://communicator/locale/notification.properties");
]]>
</field>
<field name="_brandStringBundle" readonly="true">
<![CDATA[
- Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle("chrome://branding/locale/brand.properties");
+ Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle("chrome://branding/locale/brand.properties");
]]>
</field>
<field name="_prefs" readonly="true">
<![CDATA[
- Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+ Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch);
]]>
</field>
<field name="_urlFormatter" readonly="true">
<![CDATA[
- Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
- .getService(Components.interfaces.nsIURLFormatter);
+ Cc["@mozilla.org/toolkit/URLFormatterService;1"]
+ .getService(Ci.nsIURLFormatter);
]]>
</field>
<field name="wrappedJSObject">this</field>
<field name="_activeBrowser">null</field>
<property name="activeBrowser" readonly="true">
@@ -70,18 +70,18 @@
<field name="_cwu">null</field>
<property name="contentWindowUtils" readonly="true">
<getter>
<![CDATA[
if (!this._cwu)
this._cwu = this.activeBrowser.contentWindow
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindowUtils);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
return this._cwu;
]]>
</getter>
</property>
<field name="usePrivateBrowsing" readonly="true">
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
@@ -104,19 +104,19 @@
</body>
</method>
<method name="addProgressListener">
<body>
<![CDATA[
if (this.activeBrowser && !this._addedProgressListener) {
this.activeBrowser.webProgress
- .addProgressListener(this, Components.interfaces.nsIWebProgress.NOTIFY_SECURITY |
- Components.interfaces.nsIWebProgress.NOTIFY_LOCATION |
- Components.interfaces.nsIWebProgress.NOTIFY_REFRESH);
+ .addProgressListener(this, Ci.nsIWebProgress.NOTIFY_SECURITY |
+ Ci.nsIWebProgress.NOTIFY_LOCATION |
+ Ci.nsIWebProgress.NOTIFY_REFRESH);
this._addedProgressListener = true;
}
]]>
</body>
</method>
<field name="lastMessage">"EnterInsecureMessage"</field>
<field name="lastState">0</field>
@@ -124,17 +124,17 @@
<method name="onSecurityChange">
<parameter name="aWebProgress"/>
<parameter name="aRequest"/>
<parameter name="aState"/>
<body>
<![CDATA[
if (aState < 0)
aState = this.lastState;
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
var pref = "security.warn_leaving_secure";
var message = "EnterInsecureMessage";
var priority = this.PRIORITY_WARNING_LOW;
var pane = "ssl_pane";
var buttons = [];
if (aState & nsIWebProgressListener.STATE_IS_SECURE) {
pref = "security.warn_entering_secure";
message = "EnterSecureMessage";
@@ -151,17 +151,17 @@
message = "MixedActiveContentMessage";
priority = this.PRIORITY_CRITICAL_LOW;
} else if (aState & nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT &&
this._prefs.getBoolPref("security.warn_mixed_active_content")) {
pref = "security.warn_mixed_active_content";
message = "BlockedActiveContentMessage";
priority = this.PRIORITY_INFO_LOW;
this.lastState = aState & ~nsIWebProgressListener.STATE_BLOCKED_MIXED_ACTIVE_CONTENT;
- const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
+ const nsIWebNavigation = Ci.nsIWebNavigation;
buttons = [{
label: this._stringBundle.GetStringFromName("SecurityKeepBlocking.label"),
accessKey: this._stringBundle.GetStringFromName("SecurityKeepBlocking.accesskey"),
callback: this.onSecurityChange.bind(this, null, null, -1)
}, {
label: this._stringBundle.GetStringFromName("SecurityUnblock.label"),
accessKey: this._stringBundle.GetStringFromName("SecurityUnblock.accesskey"),
callback: this.reloadPage.bind(this,
@@ -185,20 +185,20 @@
buttons = [{
label: this._stringBundle.GetStringFromName("SecurityKeepBlocking.label"),
accessKey: this._stringBundle.GetStringFromName("SecurityKeepBlocking.accesskey"),
callback: this.onSecurityChange.bind(this, null, null, -1)
}, {
label: this._stringBundle.GetStringFromName("SecurityUnblock.label"),
accessKey: this._stringBundle.GetStringFromName("SecurityUnblock.accesskey"),
callback: () => {
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
- Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(nsIPermissionManager)
- .add(this.activeBrowser.currentURI,
+ const nsIPermissionManager = Ci.nsIPermissionManager;
+ Cc["@mozilla.org/permissionmanager;1"]
+ .getService(nsIPermissionManager)
+ .add(this.activeBrowser.currentURI,
"trackingprotection",
nsIPermissionManager.ALLOW_ACTION);
this.reloadPage();
}
}];
}
} else if (aState & nsIWebProgressListener.STATE_LOADED_MIXED_DISPLAY_CONTENT &&
this._prefs.getBoolPref("security.warn_mixed_display_content")) {
@@ -245,17 +245,17 @@
<method name="onLocationChange">
<parameter name="aWebProgress" />
<parameter name="aRequest" />
<parameter name="aLocation" />
<parameter name="aFlags" />
<body>
<![CDATA[
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
if (aWebProgress.DOMWindow == this.activeBrowser.contentWindow &&
!(aFlags & nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT))
this.onDocumentChange();
]]>
</body>
</method>
<method name="onRefreshAttempted">
@@ -279,17 +279,17 @@
if (notification) {
notification.label = message;
} else {
let buttons = [{
label: refreshButtonText,
accessKey: refreshButtonAccesskey,
callback: function (aNotification, aButton) {
var refreshURI = aNotification.webProgress
- .QueryInterface(Components.interfaces.nsIRefreshURI);
+ .QueryInterface(Ci.nsIRefreshURI);
refreshURI.forceRefreshURI(aNotification.uri,
aNotification.delay, true);
}
}];
notification =
this.appendNotification(message, "refresh-blocked", null,
this.PRIORITY_INFO_MEDIUM, buttons);
}
@@ -350,17 +350,17 @@
uri = aFormElement.nodePrincipal.URI;
} catch (e) {}
if (!uri)
uri = aFormElement.ownerDocument.documentURIObject;
if (uri.schemeIs("https"))
return;
var warn = { value: true };
- var prompt = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
+ var prompt = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService);
aCancel.value = prompt.confirmEx(
aWindow,
this._stringBundle.GetStringFromName("SecurityTitle"),
this._stringBundle.GetStringFromName("PostToInsecureFromInsecureMessage"),
prompt.BUTTON_TITLE_IS_STRING * prompt.BUTTON_POS_0 +
prompt.BUTTON_TITLE_CANCEL * prompt.BUTTON_POS_1,
this._stringBundle.GetStringFromName("PostToInsecureContinue"),
null, null,
@@ -381,32 +381,32 @@
var browser = this.activeBrowser;
// inactive sidebar panel:
if (!browser || !browser.docShell)
return;
switch (aTopic) {
case "indexedDB-permissions-prompt":
- var requestor = aSubject.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
- var contentWindow = requestor.getInterface(Components.interfaces.nsIDOMWindow);
+ var requestor = aSubject.QueryInterface(Ci.nsIInterfaceRequestor);
+ var contentWindow = requestor.getInterface(Ci.nsIDOMWindow);
if (contentWindow.top == browser.contentWindow)
this.promptIndexedDB(requestor, contentWindow, "permissions");
break;
case "indexedDB-quota-prompt":
- var requestor = aSubject.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
- var contentWindow = requestor.getInterface(Components.interfaces.nsIDOMWindow);
+ var requestor = aSubject.QueryInterface(Ci.nsIInterfaceRequestor);
+ var contentWindow = requestor.getInterface(Ci.nsIDOMWindow);
if (contentWindow.top == browser.contentWindow)
this.promptIndexedDB(requestor, contentWindow, "quota", aData);
break;
case "indexedDB-quota-cancel":
- var requestor = aSubject.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
- var contentWindow = requestor.getInterface(Components.interfaces.nsIDOMWindow);
+ var requestor = aSubject.QueryInterface(Ci.nsIInterfaceRequestor);
+ var contentWindow = requestor.getInterface(Ci.nsIDOMWindow);
if (contentWindow.top == browser.contentWindow)
this.cancelIndexedDB(requestor, contentWindow, "quota", aData);
break;
case "addon-install-blocked":
var installInfo = aSubject.wrappedJSObject;
if (installInfo.browser == browser)
this.addonInstallBlocked(installInfo);
@@ -441,20 +441,20 @@
if (!doc.documentElement)
break;
var manifest = doc.documentElement.getAttribute("manifest");
if (!manifest)
break;
try {
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
var manifestURI = ioService.newURI(manifest, doc.characterSet, doc.documentURIObject);
- var cacheUpdate = aSubject.QueryInterface(Components.interfaces.nsIOfflineCacheUpdate);
+ var cacheUpdate = aSubject.QueryInterface(Ci.nsIOfflineCacheUpdate);
if (manifestURI.equals(cacheUpdate.manifestURI))
this.checkUsage(manifestURI);
} catch (e) {
alert(e);
}
break;
case "nsPref:changed":
@@ -511,17 +511,17 @@
if (popupNotification)
this.removeNotification(popupNotification);
this.popupCount = 0;
this.notifyPopupCountChanged();
}
break;
case "perm-changed":
- var permission = aSubject.QueryInterface(Components.interfaces.nsIPermission);
+ var permission = aSubject.QueryInterface(Ci.nsIPermission);
if (permission.type != "popup" || aData != "added" || !this.popupCount)
return;
if (permission.matchesURI(this.activeBrowser.currentURI, false)) {
var popupNotification = this.getNotificationWithValue("popup-blocked");
if (popupNotification)
this.removeNotification(popupNotification);
this.popupCount = 0;
@@ -552,23 +552,23 @@
mimetype = "application/x-java-vm";
} else {
if (pluginElement instanceof HTMLObjectElement) {
pluginsPage = pluginElement.codebase;
} else {
pluginsPage = pluginElement.getAttribute("pluginspage");
if (pluginsPage) {
var doc = pluginElement.ownerDocument;
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
pluginsPage = ioService.newURI(pluginsPage, doc.characterSet, doc.documentURIObject).spec;
}
}
- mimetype = pluginElement.QueryInterface(Components.interfaces.nsIObjectLoadingContent)
+ mimetype = pluginElement.QueryInterface(Ci.nsIObjectLoadingContent)
.actualType;
if (!mimetype) {
mimetype = pluginElement.type;
}
}
var navMimeType = navigator.mimeTypes.namedItem(mimetype);
@@ -633,47 +633,47 @@
</body>
</method>
<method name="canActivatePlugin">
<parameter name="aPlugin"/>
<parameter name="aSkipFallbackType"/>
<body>
<![CDATA[
- const nsIObjectLoadingContent = Components.interfaces.nsIObjectLoadingContent;
+ const nsIObjectLoadingContent = Ci.nsIObjectLoadingContent;
var objLoadingContent = aPlugin.QueryInterface(nsIObjectLoadingContent);
var actualType = objLoadingContent.actualType;
if (objLoadingContent.getContentTypeForMIMEType(actualType) != nsIObjectLoadingContent.TYPE_PLUGIN ||
objLoadingContent.activated ||
(!aSkipFallbackType &&
(objLoadingContent.pluginFallbackType < nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY ||
objLoadingContent.pluginFallbackType > nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE)))
return false;
- var ph = Components.classes["@mozilla.org/plugin/host;1"]
- .getService(Components.interfaces.nsIPluginHost);
+ var ph = Cc["@mozilla.org/plugin/host;1"]
+ .getService(Ci.nsIPluginHost);
var permissionString = ph.getPermissionStringForType(actualType);
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
- var pm = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(nsIPermissionManager);
+ const nsIPermissionManager = Ci.nsIPermissionManager;
+ var pm = Cc["@mozilla.org/permissionmanager;1"]
+ .getService(nsIPermissionManager);
var pluginPermission = pm.testPermission(this.activeBrowser.currentURI, permissionString);
return pluginPermission != nsIPermissionManager.DENY_ACTION;
]]>
</body>
</method>
<method name="setPermissionForPlugins">
<parameter name="aPermission"/>
<body>
<![CDATA[
- var ph = Components.classes["@mozilla.org/plugin/host;1"]
- .getService(Components.interfaces.nsIPluginHost);
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
- var pm = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(nsIPermissionManager);
+ var ph = Cc["@mozilla.org/plugin/host;1"]
+ .getService(Ci.nsIPluginHost);
+ const nsIPermissionManager = Ci.nsIPermissionManager;
+ var pm = Cc["@mozilla.org/permissionmanager;1"]
+ .getService(nsIPermissionManager);
for (var type of this.clickToPlayTypes) {
var permissionString = ph.getPermissionStringForType(type);
pm.add(this.activeBrowser.currentURI, permissionString, aPermission);
}
]]>
</body>
</method>
@@ -718,34 +718,34 @@
</body>
</method>
<method name="stopPlayPreview">
<parameter name="aPlugin"/>
<parameter name="aPlayPlugin"/>
<body>
<![CDATA[
- var objLoadingContent = aPlugin.QueryInterface(Components.interfaces.nsIObjectLoadingContent);
+ var objLoadingContent = aPlugin.QueryInterface(Ci.nsIObjectLoadingContent);
if (objLoadingContent.activated)
return;
if (aPlayPlugin)
objLoadingContent.playPlugin();
else
objLoadingContent.cancelPlayPreview();
]]>
</body>
</method>
<method name="openURLPref">
<parameter name="aPref"/>
<body>
<![CDATA[
var url = this._urlFormatter.formatURLPref(aPref);
- var nsIBrowserDOMWindow = Components.interfaces.nsIBrowserDOMWindow;
+ var nsIBrowserDOMWindow = Ci.nsIBrowserDOMWindow;
var browserWin;
var whereToOpen = this._prefs.getIntPref("browser.link.open_external");
if (whereToOpen != nsIBrowserDOMWindow.OPEN_NEWWINDOW) {
browserWin = Services.wm.getMostRecentWindow("navigator:browser");
}
@@ -772,35 +772,35 @@
</body>
</method>
<method name="getBindingType">
<parameter name="aPlugin"/>
<body>
<![CDATA[
// Helper to get the binding handler type from a plugin object
- if (!(aPlugin instanceof Components.interfaces.nsIObjectLoadingContent))
+ if (!(aPlugin instanceof Ci.nsIObjectLoadingContent))
return null;
switch (aPlugin.pluginFallbackType) {
- case Components.interfaces.nsIObjectLoadingContent.PLUGIN_UNSUPPORTED:
+ case Ci.nsIObjectLoadingContent.PLUGIN_UNSUPPORTED:
return "PluginNotFound";
- case Components.interfaces.nsIObjectLoadingContent.PLUGIN_DISABLED:
+ case Ci.nsIObjectLoadingContent.PLUGIN_DISABLED:
return "PluginDisabled";
- case Components.interfaces.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED:
+ case Ci.nsIObjectLoadingContent.PLUGIN_BLOCKLISTED:
return "PluginBlocklisted";
- case Components.interfaces.nsIObjectLoadingContent.PLUGIN_OUTDATED:
+ case Ci.nsIObjectLoadingContent.PLUGIN_OUTDATED:
return "PluginOutdated";
- case Components.interfaces.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY:
+ case Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY:
return "PluginClickToPlay";
- case Components.interfaces.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE:
+ case Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE:
return "PluginVulnerableUpdatable";
- case Components.interfaces.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE:
+ case Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE:
return "PluginVulnerableNoUpdate";
- case Components.interfaces.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW:
+ case Ci.nsIObjectLoadingContent.PLUGIN_PLAY_PREVIEW:
return "PluginPlayPreview";
default:
// Not all states map to a handler
return null;
}
]]>
</body>
</method>
@@ -1021,24 +1021,24 @@
<method name="playSoundForBlockedPopup">
<body>
<![CDATA[
const kCustomSound = 1;
var playSound = this._prefs.getBoolPref("privacy.popups.sound_enabled");
if (playSound) {
- var sound = Components.classes["@mozilla.org/sound;1"]
- .createInstance(Components.interfaces.nsISound);
+ var sound = Cc["@mozilla.org/sound;1"]
+ .createInstance(Ci.nsISound);
var soundType = this._prefs.getIntPref("privacy.popups.sound_type");
if (soundType == kCustomSound) {
var soundUrlSpec = this._prefs.getCharPref("privacy.popups.sound_url");
- var fileHandler = Components.classes["@mozilla.org/network/protocol;1?name=file"]
- .getService(Components.interfaces.nsIFileProtocolHandler);
+ var fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"]
+ .getService(Ci.nsIFileProtocolHandler);
var file = fileHandler.getFileFromURLSpec(soundUrlSpec);
if (file.exists()) {
var soundUrl = fileHandler.newFileURI(file);
sound.play(soundUrl);
return;
}
}
@@ -1060,55 +1060,55 @@
]]>
</body>
</method>
<method name="allowPopupsForSite">
<parameter name="aEvent"/>
<body>
<![CDATA[
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
+ const nsIPermissionManager = Ci.nsIPermissionManager;
var uri = this.activeBrowser.currentURI;
- var pm = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(nsIPermissionManager);
+ var pm = Cc["@mozilla.org/permissionmanager;1"]
+ .getService(nsIPermissionManager);
pm.add(uri, "popup", nsIPermissionManager.ALLOW_ACTION);
this.removeCurrentNotification();
]]>
</body>
</method>
<method name="offlineAppRequested">
<parameter name="aDocument"/>
<body>
<![CDATA[
var documentURI = aDocument.documentURIObject;
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
- var pm = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(nsIPermissionManager);
+ const nsIPermissionManager = Ci.nsIPermissionManager;
+ var pm = Cc["@mozilla.org/permissionmanager;1"]
+ .getService(nsIPermissionManager);
if (pm.testExactPermission(documentURI, "offline-app") !=
nsIPermissionManager.UNKNOWN_ACTION)
return;
var host = documentURI.asciiHost;
var notificationName = "offline-app-requested-" + host;
var notification = this.getNotificationWithValue(notificationName);
if (notification)
notification.documents.push(aDocument);
else {
var buttons = [{
label: this._stringBundle.GetStringFromName("offlineApps.always"),
accessKey: this._stringBundle.GetStringFromName("offlineApps.always.accesskey"),
callback: function() {
pm.add(documentURI, "offline-app", nsIPermissionManager.ALLOW_ACTION);
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var updateService = Components.classes["@mozilla.org/offlinecacheupdate-service;1"]
- .getService(Components.interfaces.nsIOfflineCacheUpdateService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+ var updateService = Cc["@mozilla.org/offlinecacheupdate-service;1"]
+ .getService(Ci.nsIOfflineCacheUpdateService);
notification.documents.forEach(function(aDocument) {
if (!aDocument.documentElement)
return;
var manifest = aDocument.documentElement.getAttribute("manifest");
if (!manifest)
return;
try {
@@ -1142,55 +1142,55 @@
]]>
</body>
</method>
<method name="checkUsage">
<parameter name="aURI"/>
<body>
<![CDATA[
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
- var pm = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(nsIPermissionManager);
+ const nsIPermissionManager = Ci.nsIPermissionManager;
+ var pm = Cc["@mozilla.org/permissionmanager;1"]
+ .getService(nsIPermissionManager);
if (pm.testExactPermission(aURI, "offline-app") ==
- Components.interfaces.nsIOfflineCacheUpdateService.ALLOW_NO_WARN)
+ Ci.nsIOfflineCacheUpdateService.ALLOW_NO_WARN)
return;
var host = aURI.asciiHost;
var usage = 0;
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"]
- .getService(Components.interfaces.nsIApplicationCacheService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+ var cacheService = Cc["@mozilla.org/network/application-cache-service;1"]
+ .getService(Ci.nsIApplicationCacheService);
cacheService.getGroups().forEach(function(aGroup) {
var uri = ioService.newURI(aGroup);
if (uri.asciiHost == host)
usage += cacheService.getActiveCache(aGroup).usage;
});
var warnQuota = this._prefs.getIntPref("offline-apps.quota.warn");
if (usage < warnQuota * 1024)
return;
var message = this._stringBundle.formatStringFromName("offlineApps.quota", [host, warnQuota / 1024], 2);
var priority = this.PRIORITY_WARNING_MEDIUM;
this.appendNotification(message, "offline-app-usage", null,
priority, null);
pm.add(aURI, "offline-app",
- Components.interfaces.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
+ Ci.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
]]>
</body>
</method>
<method name="showRightsNotification">
<body>
<![CDATA[
- var rightsBundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle("chrome://branding/locale/aboutRights.properties");
+ var rightsBundle = Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle("chrome://branding/locale/aboutRights.properties");
var buttonLabel = rightsBundle.GetStringFromName("buttonLabel");
var buttonAccessKey = rightsBundle.GetStringFromName("buttonAccessKey");
var productName = this._brandStringBundle.GetStringFromName("brandFullName");
var notifyRightsText = rightsBundle.formatStringFromName("notifyRightsText", [productName], 1);
var buttons = [{
label: buttonLabel,
accessKey: buttonAccessKey,
@@ -1234,19 +1234,19 @@
<![CDATA[
var brandShortName = this._brandStringBundle.GetStringFromName("brandShortName");
var message = this._stringBundle.formatStringFromName("updatePrompt.text", [brandShortName], 1);
var buttons = [{
label: this._stringBundle.GetStringFromName("updatePromptCheckButton.label"),
accessKey: this._stringBundle.GetStringFromName("updatePromptCheckButton.accesskey"),
popup: null,
callback: function() {
- Components.classes["@mozilla.org/updates/update-prompt;1"]
- .createInstance(Components.interfaces.nsIUpdatePrompt)
- .checkForUpdates();
+ Cc["@mozilla.org/updates/update-prompt;1"]
+ .createInstance(Ci.nsIUpdatePrompt)
+ .checkForUpdates();
}
}];
var box = this.appendNotification(message, "update-warning", null,
this.PRIORITY_CRITICAL_MEDIUM,
buttons);
box.persistence = -1; // until user closes it
]]>
</body>
@@ -1358,17 +1358,17 @@
var notification = this.getNotificationWithValue("click-to-play-plugins");
if (notification || !aTriggeredByNewPlugin)
return;
var checkbox = document.createElement("checkbox");
checkbox.className = "rememberChoice";
checkbox.setAttribute("label", this._stringBundle.GetStringFromName("activatepluginsMessage.remember"));
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
+ const nsIPermissionManager = Ci.nsIPermissionManager;
var messageString = this._stringBundle.GetStringFromName("activatepluginsMessage.title");
var buttons = [{
label: this._stringBundle.GetStringFromName("activatepluginsMessage.activate.label"),
accessKey: this._stringBundle.GetStringFromName("activatepluginsMessage.activate.accesskey"),
callback: (function () {
if (checkbox.checked)
this.setPermissionForPlugins(nsIPermissionManager.ALLOW_ACTION);
this.activatePlugins(checkbox.checked);
@@ -1553,17 +1553,17 @@
</method>
<method name="showWebNotificationPrompt">
<parameter name="site"/>
<parameter name="allowCallback"/>
<parameter name="cancelCallback"/>
<body>
<![CDATA[
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
+ const nsIPermissionManager = Ci.nsIPermissionManager;
var type = "webNotifications";
if (this.getNotificationWithValue(type))
return;
var buttons = [{
label: this._stringBundle.GetStringFromName(type + ".showForSession"),
accessKey: this._stringBundle.GetStringFromName(type + ".showForSession.accesskey"),
popup: null,
@@ -1615,18 +1615,18 @@
<parameter name="aData"/>
<body>
<![CDATA[
var host = aWindow.document.documentURIObject.asciiHost;
var property = this.usePrivateBrowsing ? "offlineApps.private" :
"offlineApps." + aTopic;
var message = this._stringBundle.formatStringFromName(property,
[host, aData], 2);
- var observer = aRequestor.getInterface(Components.interfaces.nsIObserver);
- var nsIPermissionManager = Components.interfaces.nsIPermissionManager;
+ var observer = aRequestor.getInterface(Ci.nsIObserver);
+ var nsIPermissionManager = Ci.nsIPermissionManager;
var buttons = [{
label: this._stringBundle.GetStringFromName("offlineApps.always"),
accessKey: this._stringBundle.GetStringFromName("offlineApps.always.accesskey"),
popup: null,
callback: function allowIndexedDB() {
clearTimeout(box.timeout);
observer.observe(null, "indexedDB-" + aTopic + "-response",
nsIPermissionManager.ALLOW_ACTION);
@@ -1673,17 +1673,17 @@
<body>
<![CDATA[
var popupNotification = this.getNotificationWithValue("indexedDB-" + aTopic + "-prompt");
if (popupNotification) {
clearTimeout(popupNotification.timeout);
this.removeNotification(popupNotification);
}
- var observer = aRequestor.getInterface(Components.interfaces.nsIObserver);
+ var observer = aRequestor.getInterface(Ci.nsIObserver);
observer.observe(null, "indexedDB-" + aTopic + "-response",
nsIPermissionManager.UNKNOWN_ACTION);
]]>
</body>
</method>
<method name="addonInstallBlocked">
<parameter name="installInfo"/>
@@ -1728,18 +1728,18 @@
var notificationName = "addon-install-cancelled";
var messageString = this._stringBundle.GetStringFromName("addonDownloadCancelled");
messageString = tmp.PluralForm.get(installInfo.installs.length, messageString);
var buttons = [{
label: this._stringBundle.GetStringFromName("addonDownloadRestartButton"),
accessKey: this._stringBundle.GetStringFromName("addonDownloadRestartButton.accesskey"),
popup: null,
callback: function() {
- var weblistener = Components.classes["@mozilla.org/addons/web-install-listener;1"]
- .getService(Components.interfaces.amIWebInstallListener);
+ var weblistener = Cc["@mozilla.org/addons/web-install-listener;1"]
+ .getService(Ci.amIWebInstallListener);
if (weblistener.onWebInstallRequested(installInfo.browser, installInfo.originatingURI,
[aInstall], 1)) {
aInstall.install();
}
}
}];
var priority = this.PRIORITY_INFO_MEDIUM;
this.appendNotification(messageString, notificationName,
@@ -1856,26 +1856,26 @@
var name = installInfo.installs[0].name;
installInfo.installs.some(function(install) {
if (install.error) {
name = install.name;
error = "addonError" + install.error;
return true;
}
if (install.addon.blocklistState ==
- Components.interfaces.nsIBlocklistService.STATE_BLOCKED) {
+ Ci.nsIBlocklistService.STATE_BLOCKED) {
name = install.name;
error = "addonErrorBlocklisted";
}
return false;
});
var brandShortName = this._brandStringBundle.GetStringFromName("brandShortName");
- var version = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULAppInfo).version;
+ var version = Cc["@mozilla.org/xre/app-info;1"]
+ .getService(Ci.nsIXULAppInfo).version;
var messageString = this._stringBundle.GetStringFromName(error)
.replace("#1", name)
.replace("#2", host)
.replace("#3", brandShortName)
.replace("#4", version);
var priority = this.PRIORITY_WARNING_MEDIUM;
this.appendNotification(messageString, notificationName,
@@ -1917,23 +1917,23 @@
</body>
</method>
<method name="ignoreSafeBrowsingWarning">
<parameter name="aReason"/>
<body>
<![CDATA[
var uri = this.activeBrowser.currentURI;
- var flag = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER;
+ var flag = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CLASSIFIER;
this.activeBrowser.loadURIWithFlags(uri.asciiSpec, flag,
null, null, null);
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
- var pm = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(nsIPermissionManager);
+ const nsIPermissionManager = Ci.nsIPermissionManager;
+ var pm = Cc["@mozilla.org/permissionmanager;1"]
+ .getService(nsIPermissionManager);
pm.add(uri, "safe-browsing", nsIPermissionManager.ALLOW_ACTION,
nsIPermissionManager.EXPIRE_SESSION);
var title, label, accessKey, reportName, buttons;
switch (aReason) {
case "phishing":
title = "safebrowsing.deceptiveSite";
@@ -1990,18 +1990,18 @@
]]>
</body>
</method>
<constructor>
<![CDATA[
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.addObserver(this, "indexedDB-permissions-prompt");
os.addObserver(this, "indexedDB-quota-prompt");
os.addObserver(this, "indexedDB-quota-cancel");
os.addObserver(this, "addon-install-blocked");
os.addObserver(this, "addon-install-complete");
os.addObserver(this, "addon-install-disabled");
os.addObserver(this, "addon-install-failed");
os.addObserver(this, "addon-install-started");
@@ -2040,18 +2040,18 @@
this.mDestroyed = true;
if (this._addedProgressListener) {
this.activeBrowser.webProgress.removeProgressListener(this);
this._addedProgressListener = false;
}
this._activeBrowser = null;
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
try {
os.removeObserver(this, "indexedDB-permissions-prompt");
} catch (ex) {}
try {
os.removeObserver(this, "indexedDB-quota-prompt");
} catch (ex) {}
try {
os.removeObserver(this, "indexedDB-quota-cancel");
@@ -2102,19 +2102,19 @@
</implementation>
<handlers>
<handler event="DOMContentLoaded" phase="capturing">
<![CDATA[
if (/^about:neterror\?e=netOffline/.test(event.target.documentURI))
event.target.addEventListener("click", function tryAgain(event) {
if (event.target.id == "errorTryAgain")
- Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService)
- .offline = false;
+ Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+ .offline = false;
}, true);
]]>
</handler>
<handler event="DOMUpdatePageReport" phase="capturing">
<![CDATA[
var browser = this.activeBrowser;
if (!browser.blockedPopups || browser.blockedPopups.reported != false)
@@ -2157,17 +2157,17 @@
null, priority, buttons);
}
}
]]>
</handler>
<handler event="PluginBindingAttached" phase="capturing" allowuntrusted="true">
<![CDATA[
- var nsIObjectLoadingContent = Components.interfaces.nsIObjectLoadingContent;
+ var nsIObjectLoadingContent = Ci.nsIObjectLoadingContent;
var plugin = event.target;
// Since we are expecting also untrusted events, make sure
// that the target is a plugin
if (!(plugin instanceof nsIObjectLoadingContent))
return;
var closeIcon = this.getPluginUI(plugin, "closeIcon");
this.addLinkClickCallback(closeIcon, this.hidePluginOverlay, plugin);
@@ -2260,17 +2260,17 @@
]]>
</handler>
<handler event="PluginCrashed" phase="capturing">
<![CDATA[
// Ensure the plugin and event are of the right type.
var plugin = event.target;
var detail = event.detail;
- if (!(detail instanceof Components.interfaces.nsIPropertyBag2))
+ if (!(detail instanceof Ci.nsIPropertyBag2))
return;
var submittedReport = detail.getPropertyAsBool("submittedCrashReport");
var doPrompt = true; // XXX followup for .getPropertyAsBool("doPrompt");
var submitReports = true; // XXX followup for .getPropertyAsBool("submitReports");
var pluginName = detail.getPropertyAsAString("pluginName");
var pluginFilename = detail.getPropertyAsAString("pluginFilename");
var pluginDumpID = detail.getPropertyAsAString("pluginDumpID");
@@ -2309,37 +2309,37 @@
optInCB.checked = this._prefs.getBoolPref("dom.ipc.plugins.reportCrashURL");
}
// If we're showing the link to manually trigger report submission, we'll
// want to be able to update all the instances of the UI for this crash to
// show an updated message when a report is submitted.
if (doPrompt) {
let observer = {
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
- Components.interfaces.nsISupportsWeakReference]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
+ Ci.nsISupportsWeakReference]),
observe: function(subject, topic, data) {
let propertyBag = subject;
- if (!(propertyBag instanceof Components.interfaces.nsIPropertyBag2))
+ if (!(propertyBag instanceof Ci.nsIPropertyBag2))
return;
// Ignore notifications for other crashes.
if (propertyBag.get("minidumpID") != pluginDumpID)
return;
statusDiv.setAttribute("status", data);
},
handleEvent : function(event) {
// Not expected to be called, just here for the closure.
}
}
// Use a weak reference, so we don't have to remove it...
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService)
- .addObserver(observer, "crash-report-status", true);
+ Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService)
+ .addObserver(observer, "crash-report-status", true);
// ...alas, now we need something to hold a strong reference to prevent
// it from being GC. But I don't want to manually manage the reference's
// lifetime (which should be no greater than the page).
// Clever solution? Use a closure with an event listener on the statusDiv.
// When it goes away, so do the listener references and the closure.
statusDiv.addEventListener("mozCleverClosureHack", observer);
}
}
@@ -2395,40 +2395,40 @@
<handler event="npapi-carbon-event-model-failure" phase="capturing">
<![CDATA[
var plugin = event.target;
// Force a style flush, so that we ensure our binding is attached.
plugin.clientTop;
function callback() {
// Notify all windows that an application quit has been requested.
- var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
+ .createInstance(Ci.nsISupportsPRBool);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.notifyObservers(cancelQuit, "quit-application-requested");
// Something aborted the quit process.
if (cancelQuit.data)
return;
- var nsIAppStartup = Components.interfaces.nsIAppStartup;
- Components.classes["@mozilla.org/toolkit/app-startup;1"]
- .getService(nsIAppStartup)
- .quit(nsIAppStartup.eAttemptQuit |
+ var nsIAppStartup = Ci.nsIAppStartup;
+ Cc["@mozilla.org/toolkit/app-startup;1"]
+ .getService(nsIAppStartup)
+ .quit(nsIAppStartup.eAttemptQuit |
nsIAppStartup.eRestart |
nsIAppStartup.eRestarti386);
}
var notification = "carbon-failure-plugins";
var pref = "plugins.hide_infobar_for_carbon_failure_plugin";
if ("@mozilla.org/xpcom/mac-utils;1" in Components.classes &&
- !Components.classes["@mozilla.org/xpcom/mac-utils;1"]
- .getService(Components.interfaces.nsIMacUtils)
- .isUniversalBinary) {
+ !Cc["@mozilla.org/xpcom/mac-utils;1"]
+ .getService(Ci.nsIMacUtils)
+ .isUniversalBinary) {
pref = null;
notification = "missing-plugins";
callback = this.openURLPref.bind(this, "plugins.update.url");
}
var prefix = notification.replace(/-/g, "");
var message = this._stringBundle.GetStringFromName(prefix + "Message.title");
var buttons = [{
@@ -2477,17 +2477,17 @@
<implementation>
<method name="onLocationChange">
<parameter name="aWebProgress" />
<parameter name="aRequest" />
<parameter name="aLocation" />
<parameter name="aFlags" />
<body>
<![CDATA[
- const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
+ const nsIWebProgressListener = Ci.nsIWebProgressListener;
if (aWebProgress.DOMWindow == this.activeBrowser.contentWindow &&
!(aFlags & nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
this.onDocumentChange();
PopupNotifications.locationChange(this.activeBrowser);
}
]]>
</body>
</method>
@@ -2592,23 +2592,23 @@
for (let [pluginName, namedPluginArray] of pluginsDictionary) {
let plugin = namedPluginArray[0];
let warn = false;
let warningText = "";
let updateLink = "";
if (plugin.pluginFallbackType) {
if (plugin.pluginFallbackType ==
- Components.interfaces.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE) {
+ Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE) {
updateLink = this._urlFormatter.formatURLPref("plugins.update.url");
warn = true;
warningText = this._stringBundle.GetStringFromName("vulnerableUpdatablePluginWarning");
}
else if (plugin.pluginFallbackType ==
- Components.interfaces.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE) {
+ Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE) {
warn = true;
warningText = this._stringBundle.GetStringFromName("vulnerableNoUpdatePluginWarning");
}
}
let action = {
message: pluginName,
warn: warn,
@@ -2649,29 +2649,29 @@
notification.remove();
]]>
</body>
</method>
<method name="showPluginClickToPlayPrompt">
<body>
<![CDATA[
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
+ const nsIPermissionManager = Ci.nsIPermissionManager;
var mainAction = {
label: this._stringBundle.GetStringFromName("activatepluginsMessage.activate.label"),
accessKey: this._stringBundle.GetStringFromName("activatepluginsMessage.activate.accesskey"),
callback: this.activatePlugins.bind(this)
};
var centerActions = this.makeCenterActions();
var haveVulnerablePlugin = this.contentWindowUtils.plugins.some(function(plugin) {
return (this.canActivatePlugin(plugin) &&
(plugin.pluginFallbackType ==
- Components.interfaces.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE ||
+ Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE ||
plugin.pluginFallbackType ==
- Components.interfaces.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE));
+ Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE));
}, this);
var messageString = this._stringBundle.GetStringFromName(haveVulnerablePlugin ?
"vulnerablePluginsMessage" :
"activatepluginsMessage.title");
var secondaryActions = [{
label: this._stringBundle.GetStringFromName("activatepluginsMessage.always.label"),
accessKey: this._stringBundle.GetStringFromName("activatepluginsMessage.always.accesskey"),
callback: (function () {
@@ -2767,17 +2767,17 @@
</method>
<method name="showWebNotificationPrompt">
<parameter name="site"/>
<parameter name="allowCallback"/>
<parameter name="cancelCallback"/>
<body>
<![CDATA[
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
+ const nsIPermissionManager = Ci.nsIPermissionManager;
var type = "webNotifications";
var mainAction = {
label: this._stringBundle.GetStringFromName(type + ".showForSession"),
accessKey: this._stringBundle.GetStringFromName(type + ".showForSession.accesskey"),
callback: function(aNotification) {
allowCallback(true, nsIPermissionManager.EXPIRE_SESSION);
}
};
@@ -2826,18 +2826,18 @@
<parameter name="aData"/>
<body>
<![CDATA[
var host = aWindow.document.documentURIObject.asciiHost;
var property = this.usePrivateBrowsing ? "offlineApps.private" :
"offlineApps." + aTopic;
var message = this._stringBundle.formatStringFromName(property,
[host, aData], 2);
- var observer = aRequestor.getInterface(Components.interfaces.nsIObserver);
- var nsIPermissionManager = Components.interfaces.nsIPermissionManager;
+ var observer = aRequestor.getInterface(Ci.nsIObserver);
+ var nsIPermissionManager = Ci.nsIPermissionManager;
var mainAction = {
label: this._stringBundle.GetStringFromName("offlineApps.always"),
accessKey: this._stringBundle.GetStringFromName("offlineApps.always.accesskey"),
callback: function allowIndexedDB() {
clearTimeout(notification.timeout);
observer.observe(null, "indexedDB-" + aTopic + "-response",
nsIPermissionManager.ALLOW_ACTION);
}
@@ -2888,17 +2888,17 @@
<parameter name="aTopic"/>
<parameter name="aData"/>
<body>
<![CDATA[
var popupNotification = PopupNotifications.getNotification("indexedDB-" + aTopic + "-prompt", this.activeBrowser);
if (popupNotification)
popupNotification.remove(); // eventCallback clears the timeout
- var observer = aRequestor.getInterface(Components.interfaces.nsIObserver);
+ var observer = aRequestor.getInterface(Ci.nsIObserver);
observer.observe(null, "indexedDB-" + aTopic + "-response",
nsIPermissionManager.UNKNOWN_ACTION);
]]>
</body>
</method>
<method name="addonInstallBlocked">
<parameter name="installInfo"/>
@@ -2943,18 +2943,18 @@
ChromeUtils.import("resource://gre/modules/PluralForm.jsm", tmp);
var messageString = this._stringBundle.GetStringFromName("addonDownloadCancelled");
messageString = tmp.PluralForm.get(installInfo.installs.length, messageString);
var action = {
label: this._stringBundle.GetStringFromName("addonDownloadRestartButton"),
accessKey: this._stringBundle.GetStringFromName("addonDownloadRestartButton.accesskey"),
popup: null,
callback: function() {
- var weblistener = Components.classes["@mozilla.org/addons/web-install-listener;1"]
- .getService(Components.interfaces.amIWebInstallListener);
+ var weblistener = Cc["@mozilla.org/addons/web-install-listener;1"]
+ .getService(Ci.amIWebInstallListener);
if (weblistener.onWebInstallRequested(installInfo.browser, installInfo.originatingURI,
[aInstall], 1)) {
aInstall.install();
}
}
};
PopupNotifications.show(this.activeBrowser,
"addon-install-cancelled", messageString,
@@ -3073,26 +3073,26 @@
var name = installInfo.installs[0].name;
installInfo.installs.some(function(install) {
if (install.error) {
name = install.name;
error = "addonError" + install.error;
return true;
}
if (install.addon.blocklistState ==
- Components.interfaces.nsIBlocklistService.STATE_BLOCKED) {
+ Ci.nsIBlocklistService.STATE_BLOCKED) {
name = install.name;
error = "addonErrorBlocklisted";
}
return false;
});
var brandShortName = this._brandStringBundle.GetStringFromName("brandShortName");
- var version = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULAppInfo).version;
+ var version = Cc["@mozilla.org/xre/app-info;1"]
+ .getService(Ci.nsIXULAppInfo).version;
var messageString = this._stringBundle.GetStringFromName(error)
.replace("#1", name)
.replace("#2", host)
.replace("#3", brandShortName)
.replace("#4", version);
// Make notifications persist a minimum of 30 seconds
var options = {
--- a/suite/common/bindings/prefwindow.xml
+++ b/suite/common/bindings/prefwindow.xml
@@ -429,18 +429,18 @@
{
// Open topic in existing window.
topWindow.focus();
topWindow.displayTopic(topic);
}
else
{
// Open topic in new window.
- const params = Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
- .createInstance(Components.interfaces.nsIDialogParamBlock);
+ const params = Cc["@mozilla.org/embedcomp/dialogparam;1"]
+ .createInstance(Ci.nsIDialogParamBlock);
params.SetNumberStrings(2);
params.SetString(0, helpFileURI);
params.SetString(1, topic);
Services.ww.openWindow(null,
"chrome://help/content/help.xul",
"_blank",
"chrome,all,alwaysRaised,dialog=no",
params);
@@ -506,23 +506,23 @@
<![CDATA[
// Since all <prefpane>s now share the same global document, their
// <script>s might clash. Thus we expect the "script" attribute to
// contain a whitespace delimited list of script files to be loaded
// into the <prefpane>'s context.
var subScriptLoader = null;
try
{
- subScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
- .getService(Components.interfaces.mozIJSSubScriptLoader);
+ subScriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
+ .getService(Ci.mozIJSSubScriptLoader);
}
catch (e)
{
var msg = 'prefpane.paneload: no mozIJSSubScriptLoader!\n' + e;
- Components.utils.reportError(msg);
+ Cu.reportError(msg);
return;
}
// list of scripts to load
var scripts = this.getAttribute('script').match(/\S+/g);
if (!scripts)
return;
var count = scripts.length;
@@ -534,17 +534,17 @@
try
{
subScriptLoader.loadSubScript(script, this);
}
catch (e)
{
var msg = 'prefpane.paneload: loadSubScript("'
+ script + '") failed:\n' + e;
- Components.utils.reportError(msg);
+ Cu.reportError(msg);
}
}
}
// if we have a Startup method, call it
if ('Startup' in this)
this.Startup();
]]>
--- a/suite/common/bindings/toolbar-xpfe.xml
+++ b/suite/common/bindings/toolbar-xpfe.xml
@@ -97,17 +97,17 @@
<method name="createCollapsedGrippy">
<parameter name="aToolbar"/>
<body>
<![CDATA[
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var existingGrippy = document.getAnonymousElementByAttribute(this, "id", "moz_tb_collapsed_" + aToolbar.id);
if (!existingGrippy) {
var grippy = document.getAnonymousElementByAttribute(aToolbar, "tbattr", "toolbar-grippy");
- var boxObject = grippy.boxObject.QueryInterface(Components.interfaces.nsIBoxObject);
+ var boxObject = grippy.boxObject.QueryInterface(Ci.nsIBoxObject);
var collapsedGrippy = document.createElementNS(XUL_NS, "toolbargrippy");
if (collapsedGrippy) {
var width = boxObject.height > 20 ? boxObject.height : 23;
var height = boxObject.width > 10 ? boxObject.width : 12;
var styleString = "width: " + width + "px; height: " + height + "px;";
collapsedGrippy.setAttribute("style", styleString);
collapsedGrippy.setAttribute("tooltiptext", aToolbar.getAttribute("grippytooltiptext"));
collapsedGrippy.setAttribute("id", "moz_tb_collapsed_" + aToolbar.id);
--- a/suite/common/bookmarks/bm-props.js
+++ b/suite/common/bookmarks/bm-props.js
@@ -156,23 +156,23 @@ var BookmarkPropertiesPanel = {
if ("defaultInsertionPoint" in dialogInfo) {
this._defaultInsertionPoint = dialogInfo.defaultInsertionPoint;
}
else
this._defaultInsertionPoint =
new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX,
- Components.interfaces.nsITreeView.DROP_ON);
+ Ci.nsITreeView.DROP_ON);
switch (dialogInfo.type) {
case "bookmark":
this._itemType = BOOKMARK_ITEM;
if ("uri" in dialogInfo) {
- NS_ASSERT(dialogInfo.uri instanceof Components.interfaces.nsIURI,
+ NS_ASSERT(dialogInfo.uri instanceof Ci.nsIURI,
"uri property should be a uri object");
this._uri = dialogInfo.uri;
if (typeof(this._title) != "string") {
this._title = this._getURITitleFromHistory(this._uri) ||
this._uri.spec;
}
}
else {
@@ -275,17 +275,17 @@ var BookmarkPropertiesPanel = {
* a title from the first 100 characters of the URI.
*
* @param aURI
* nsIURI object for which we want the title
*
* @returns a title string
*/
_getURITitleFromHistory: function BPP__getURITitleFromHistory(aURI) {
- NS_ASSERT(aURI instanceof Components.interfaces.nsIURI);
+ NS_ASSERT(aURI instanceof Ci.nsIURI);
// get the title from History
return PlacesUtils.history.getPageTitle(aURI);
},
/**
* This method should be called by the onload of the Bookmark Properties
* dialog to initialize the state of the panel.
@@ -426,21 +426,21 @@ var BookmarkPropertiesPanel = {
// disabled by the input listener until the user fills the field.
var locationField = this._element("locationField");
if (locationField.value == "about:blank")
locationField.value = "";
},
// nsISupports
QueryInterface: function BPP_QueryInterface(aIID) {
- if (aIID.equals(Components.interfaces.nsIDOMEventListener) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIDOMEventListener) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
_element: function BPP__element(aID) {
return document.getElementById("editBMPanel_" + aID);
},
onDialogUnload: function BPP_onDialogUnload() {
@@ -532,17 +532,17 @@ var BookmarkPropertiesPanel = {
},
/**
* Returns a transaction for creating a new bookmark item representing the
* various fields and opening arguments of the dialog.
*/
_getCreateNewBookmarkTransaction:
function BPP__getCreateNewBookmarkTransaction(aContainer, aIndex) {
- const nsIAnnotationService = Components.interfaces.nsIAnnotationService;
+ const nsIAnnotationService = Ci.nsIAnnotationService;
var annotations = [];
var childTransactions = [];
if (this._description) {
let annoObj = { name : PlacesUIUtils.DESCRIPTION_ANNO,
type : nsIAnnotationService.TYPE_STRING,
flags : 0,
value : this._description,
--- a/suite/common/bookmarks/bookmarksManager.js
+++ b/suite/common/bookmarks/bookmarksManager.js
@@ -60,21 +60,21 @@ var PlacesOrganizer = {
toolbar.removeAttribute("autohide");
document.persist("placesToolbar", autohide);
}
window.addEventListener("AppCommand", this, true);
},
QueryInterface: function PO_QueryInterface(aIID) {
- if (aIID.equals(Components.interfaces.nsIDOMEventListener) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIDOMEventListener) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
handleEvent: function PO_handleEvent(aEvent) {
if (aEvent.type != "AppCommand")
return;
aEvent.stopPropagation();
switch (aEvent.command) {
@@ -319,56 +319,56 @@ var PlacesOrganizer = {
if (window.fromFile)
this.importFromFile();
},
/**
* Open a file-picker and import the selected file into the bookmarks store
*/
importFromFile: function PO_importFromFile() {
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(Components.interfaces.nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(Ci.nsIFilePicker);
fp.init(window, PlacesUIUtils.getString("SelectImport"),
- Components.interfaces.nsIFilePicker.modeOpen);
- fp.appendFilters(Components.interfaces.nsIFilePicker.filterHTML);
- if (fp.show() != Components.interfaces.nsIFilePicker.returnCancel) {
+ Ci.nsIFilePicker.modeOpen);
+ fp.appendFilters(Ci.nsIFilePicker.filterHTML);
+ if (fp.show() != Ci.nsIFilePicker.returnCancel) {
if (fp.fileURL) {
ChromeUtils.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
BookmarkHTMLUtils.importFromURL(fp.fileURL.spec, false)
- .then(null, Components.utils.reportError);
+ .then(null, Cu.reportError);
}
}
},
/**
* Allows simple exporting of bookmarks.
*/
exportBookmarks: function PO_exportBookmarks() {
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(Components.interfaces.nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(Ci.nsIFilePicker);
fp.init(window, PlacesUIUtils.getString("EnterExport"),
- Components.interfaces.nsIFilePicker.modeSave);
- fp.appendFilters(Components.interfaces.nsIFilePicker.filterHTML);
+ Ci.nsIFilePicker.modeSave);
+ fp.appendFilters(Ci.nsIFilePicker.filterHTML);
fp.defaultString = "bookmarks.html";
- if (fp.show() != Components.interfaces.nsIFilePicker.returnCancel) {
+ if (fp.show() != Ci.nsIFilePicker.returnCancel) {
ChromeUtils.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
BookmarkHTMLUtils.exportToFile(fp.file)
- .then(null, Components.utils.reportError);
+ .then(null, Cu.reportError);
}
},
/**
* Populates the restore menu with the dates of the backups available.
*/
populateRestoreMenu: function PO_populateRestoreMenu() {
let restorePopup = document.getElementById("fileRestorePopup");
- const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
- .getService(Components.interfaces.nsIXULChromeRegistry)
- .getSelectedLocale("global", true);
+ const locale = Cc["@mozilla.org/chrome/chrome-registry;1"]
+ .getService(Ci.nsIXULChromeRegistry)
+ .getSelectedLocale("global", true);
const dtOptions = { year: 'numeric', month: 'long', day: 'numeric' };
let dateFormatter = new Intl.DateTimeFormat(locale, dtOptions);
// Remove existing menu items. Last item is the restoreFromFile item.
while (restorePopup.childNodes.length > 1)
restorePopup.firstChild.remove();
let backupFiles = PlacesBackups.entries;
@@ -405,27 +405,27 @@ var PlacesOrganizer = {
}
},
/**
* Called when 'Choose File...' is selected from the restore menu.
* Prompts for a file and restores bookmarks to those in the file.
*/
onRestoreBookmarksFromFile: function PO_onRestoreBookmarksFromFile() {
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(Components.interfaces.nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(Ci.nsIFilePicker);
fp.init(window, PlacesUIUtils.getString("bookmarksRestoreTitle"),
- Components.interfaces.nsIFilePicker.modeOpen);
+ Ci.nsIFilePicker.modeOpen);
fp.appendFilter(PlacesUIUtils.getString("bookmarksRestoreFilterName"),
PlacesUIUtils.getString("bookmarksRestoreFilterExtension"));
- fp.appendFilters(Components.interfaces.nsIFilePicker.filterAll);
+ fp.appendFilters(Ci.nsIFilePicker.filterAll);
fp.displayDirectory = GetDesktopFolder();
- if (fp.show() != Components.interfaces.nsIFilePicker.returnCancel)
+ if (fp.show() != Ci.nsIFilePicker.returnCancel)
this.restoreBookmarksFromFile(fp.file);
},
/**
* Restores bookmarks from a JSON file.
*/
restoreBookmarksFromFile: function PO_restoreBookmarksFromFile(aFile) {
// check file extension
@@ -453,31 +453,31 @@ var PlacesOrganizer = {
},
/**
* Backup bookmarks to desktop, auto-generate a filename with a date.
* The file is a JSON serialization of bookmarks, tags and any annotations
* of those items.
*/
backupBookmarks: function PO_backupBookmarks() {
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(Components.interfaces.nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(Ci.nsIFilePicker);
fp.init(window, PlacesUIUtils.getString("bookmarksBackupTitle"),
- Components.interfaces.nsIFilePicker.modeSave);
+ Ci.nsIFilePicker.modeSave);
fp.appendFilter(PlacesUIUtils.getString("bookmarksRestoreFilterName"),
PlacesUIUtils.getString("bookmarksRestoreFilterExtension"));
- var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties);
- var backupsDir = dirSvc.get("Desk", Components.interfaces.nsIFile);
+ var dirSvc = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties);
+ var backupsDir = dirSvc.get("Desk", Ci.nsIFile);
fp.displayDirectory = backupsDir;
fp.defaultString = PlacesBackups.getFilenameForDate();
- if (fp.show() != Components.interfaces.nsIFilePicker.returnCancel)
+ if (fp.show() != Ci.nsIFilePicker.returnCancel)
PlacesBackups.saveBookmarksToJSONFile(fp.file);
},
_paneDisabled: false,
_setDetailsFieldsDisabledState:
function PO__setDetailsFieldsDisabledState(aDisabled) {
if (aDisabled) {
document.getElementById("paneElementsBroadcaster")
@@ -1183,17 +1183,17 @@ var ViewMenu = {
* The direction to sort - "ascending" or "descending".
* Can be null - the last direction or descending will be used.
*
* If both aColumnID and aDirection are null, the view will be unsorted.
*/
setSortColumn: function VM_setSortColumn(aColumn, aDirection) {
var result = document.getElementById("placeContent").result;
if (!aColumn && !aDirection) {
- result.sortingMode = Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE;
+ result.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
return;
}
var columnId;
if (aColumn) {
columnId = aColumn.getAttribute("anonid");
if (!aDirection) {
var sortColumn = this._getSortColumn();
@@ -1233,11 +1233,11 @@ var ViewMenu = {
// Use a default sort direction if none has been specified. If aDirection
// is invalid, result.sortingMode will be undefined, which has the effect
// of unsorting the tree.
aDirection = (aDirection || colLookupTable[columnId].dir).toUpperCase();
var sortConst = "SORT_BY_" + colLookupTable[columnId].key + "_" + aDirection;
result.sortingAnnotation = colLookupTable[columnId].anno || "";
- result.sortingMode = Components.interfaces.nsINavHistoryQueryOptions[sortConst];
+ result.sortingMode = Ci.nsINavHistoryQueryOptions[sortConst];
}
};
--- a/suite/common/bookmarks/browser-places.js
+++ b/suite/common/bookmarks/browser-places.js
@@ -585,23 +585,23 @@ var PlacesMenuDNDHandler = {
* @param event
* The DragEnter event that spawned the opening.
*/
onDragEnter: function PMDH_onDragEnter(event) {
// Opening menus in a Places popup is handled by the view itself.
if (!this._isStaticContainer(event.target))
return;
- this._loadTimer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ this._loadTimer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
this._loadTimer.initWithCallback(function() {
PlacesMenuDNDHandler._loadTimer = null;
event.target.lastChild.setAttribute("autoopened", "true");
event.target.lastChild.showPopup(event.target.lastChild);
- }, this._springLoadDelay, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ }, this._springLoadDelay, Ci.nsITimer.TYPE_ONE_SHOT);
event.preventDefault();
event.stopPropagation();
},
/**
* Handles dragexit on the <menu> element.
* @returns true if the element is a container element (menu or
* menu-toolbarbutton), false otherwise.
@@ -610,31 +610,31 @@ var PlacesMenuDNDHandler = {
// Closing menus in a Places popup is handled by the view itself.
if (!this._isStaticContainer(event.target))
return;
if (this._loadTimer) {
this._loadTimer.cancel();
this._loadTimer = null;
}
- let closeTimer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ let closeTimer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
closeTimer.initWithCallback(function() {
let node = PlacesControllerDragHelper.currentDropTarget;
let inHierarchy = false;
while (node && !inHierarchy) {
inHierarchy = node == event.target;
node = node.parentNode;
}
if (!inHierarchy && event.target.lastChild &&
event.target.lastChild.hasAttribute("autoopened")) {
event.target.lastChild.removeAttribute("autoopened");
event.target.lastChild.hidePopup();
}
- }, this._springLoadDelay, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ }, this._springLoadDelay, Ci.nsITimer.TYPE_ONE_SHOT);
},
/**
* Determines if a XUL element represents a static container.
* @returns true if the element is a container element (menu or
* menu-toolbarbutton), false otherwise.
*/
_isStaticContainer: function PMDH__isContainer(node) {
@@ -650,33 +650,33 @@ var PlacesMenuDNDHandler = {
/**
* Called when the user drags over the <menu> element.
* @param event
* The DragOver event.
*/
onDragOver: function PMDH_onDragOver(event) {
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX,
- Components.interfaces.nsITreeView.DROP_ON);
+ Ci.nsITreeView.DROP_ON);
if (ip && PlacesControllerDragHelper.canDrop(ip, event.dataTransfer))
event.preventDefault();
event.stopPropagation();
},
/**
* Called when the user drops on the <menu> element.
* @param event
* The Drop event.
*/
onDrop: function PMDH_onDrop(event) {
// Put the item at the end of bookmark menu.
let ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX,
- Components.interfaces.nsITreeView.DROP_ON);
+ Ci.nsITreeView.DROP_ON);
PlacesControllerDragHelper.onDrop(ip, event.dataTransfer);
event.stopPropagation();
}
};
var PlacesStarButton = {
_hasBookmarksObserver: false,
@@ -688,17 +688,17 @@ var PlacesStarButton = {
}
if (this._pendingUpdate) {
delete this._pendingUpdate;
}
},
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsINavBookmarkObserver
+ Ci.nsINavBookmarkObserver
]),
get _starredTooltip()
{
delete this._starredTooltip;
return this._starredTooltip =
gNavigatorBundle.getString("starButtonOn.tooltip");
},
@@ -715,17 +715,17 @@ var PlacesStarButton = {
this._itemGuids = [];
let aItemGuids = [];
// those objects are use to check if we are in the current iteration before
// returning any result.
let pendingUpdate = this._pendingUpdate = {};
PlacesUtils.bookmarks.fetch({url: this._uri}, b => aItemGuids.push(b.guid))
- .catch(Components.utils.reportError)
+ .catch(Cu.reportError)
.then(() => {
if (pendingUpdate != this._pendingUpdate) {
return;
}
// It's possible that onItemAdded gets called before the async statement
// calls back. For such an edge case, retain all unique entries from the
// array.
@@ -736,17 +736,17 @@ var PlacesStarButton = {
this._updateStar();
// Start observing bookmarks if needed.
if (!this._hasBookmarksObserver) {
try {
PlacesUtils.bookmarks.addObserver(this);
this._hasBookmarksObserver = true;
} catch (ex) {
- Components.utils.reportError("BookmarkingUI failed adding a bookmarks observer: " + ex);
+ Cu.reportError("BookmarkingUI failed adding a bookmarks observer: " + ex);
}
}
delete this._pendingUpdate;
});
},
_updateStar: function BUI__updateStar()
--- a/suite/common/bookmarks/editBookmarkOverlay.js
+++ b/suite/common/bookmarks/editBookmarkOverlay.js
@@ -52,17 +52,17 @@ var gEditItemOverlay = {
// force-read-only
this._readOnly = aInfo && aInfo.forceReadOnly;
// override title
this._titleOverride = aInfo && aInfo.titleOverride;
},
_showHideRows: function EIO__showHideRows() {
var isBookmark = this._itemId != -1 &&
- this._itemType == Components.interfaces.nsINavBookmarksService.TYPE_BOOKMARK;
+ this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK;
var isQuery = false;
if (this._uri)
isQuery = this._uri.schemeIs("place");
this._element("nameRow").collapsed = this._hiddenRows.indexOf("name") != -1;
this._element("folderRow").collapsed =
this._hiddenRows.indexOf("folderPicker") != -1 || this._readOnly;
this._element("tagsRow").collapsed = !this._uri ||
@@ -119,29 +119,29 @@ var gEditItemOverlay = {
this._itemIds = [];
this._element("selectionCount").hidden = true;
}
this._folderMenuList = this._element("folderMenuList");
this._folderTree = this._element("folderTree");
this._determineInfo(aInfo);
- if (aFor instanceof Components.interfaces.nsIURI) {
+ if (aFor instanceof Ci.nsIURI) {
this._itemId = -1;
this._uri = aFor;
this._readOnly = true;
}
else {
this._itemId = aFor;
// We can't store information on livemarks.
if (aFor == -1)
this._readOnly = true;
var containerId = PlacesUtils.bookmarks.getFolderIdForItem(this._itemId);
this._itemType = PlacesUtils.bookmarks.getItemType(this._itemId);
- if (this._itemType == Components.interfaces.nsINavBookmarksService.TYPE_BOOKMARK) {
+ if (this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK) {
this._uri = PlacesUtils.bookmarks.getBookmarkURI(this._itemId);
this._initTextField("keywordField",
PlacesUtils.bookmarks
.getKeywordForBookmark(this._itemId));
}
else {
this._uri = null;
this._isLivemark = false;
@@ -159,30 +159,30 @@ var gEditItemOverlay = {
this._initFolderMenuList(containerId);
// description field
this._initTextField("descriptionField",
PlacesUIUtils.getItemDescription(this._itemId));
}
if (this._itemId == -1 ||
- this._itemType == Components.interfaces.nsINavBookmarksService.TYPE_BOOKMARK) {
+ this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK) {
this._isLivemark = false;
this._initTextField("locationField", this._uri.spec);
if (!aItemIdList) {
var tags = PlacesUtils.tagging.getTagsForURI(this._uri).join(", ");
this._initTextField("tagsField", tags, false);
}
else {
this._multiEdit = true;
this._allTags = [];
this._itemIds = aItemIdList;
for (var i = 0; i < aItemIdList.length; i++) {
- if (aItemIdList[i] instanceof Components.interfaces.nsIURI) {
+ if (aItemIdList[i] instanceof Ci.nsIURI) {
this._uris[i] = aItemIdList[i];
this._itemIds[i] = -1;
}
else
this._uris[i] = PlacesUtils.bookmarks.getBookmarkURI(this._itemIds[i]);
this._tags[i] = PlacesUtils.tagging.getTagsForURI(this._uris[i]);
}
this._allTags = this._getCommonTags();
@@ -327,22 +327,22 @@ var gEditItemOverlay = {
this._folderMenuList.selectedIndex);
// Hide the folders-separator if no folder is annotated as recently-used
this._element("foldersSeparator").hidden = (menupopup.childNodes.length <= 6);
this._folderMenuList.disabled = this._readOnly;
},
QueryInterface: function EIO_QueryInterface(aIID) {
- if (aIID.equals(Components.interfaces.nsIDOMEventListener) ||
- aIID.equals(Components.interfaces.nsINavBookmarkObserver) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIDOMEventListener) ||
+ aIID.equals(Ci.nsINavBookmarkObserver) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
_element: function EIO__element(aID) {
return document.getElementById("editBMPanel_" + aID);
},
_getItemStaticTitle: function EIO__getItemStaticTitle() {
if (this._titleOverride)
@@ -538,17 +538,17 @@ var gEditItemOverlay = {
let txn = new PlacesEditItemTitleTransaction(this._itemId, newTitle);
PlacesUtils.transactionManager.doTransaction(txn);
}
},
onDescriptionFieldBlur: function EIO_onDescriptionFieldBlur() {
var description = this._element("descriptionField").value;
if (description != PlacesUIUtils.getItemDescription(this._itemId)) {
- const nsIAnnotationService = Components.interfaces.nsIAnnotationService;
+ const nsIAnnotationService = Ci.nsIAnnotationService;
var annoObj = { name : PlacesUIUtils.DESCRIPTION_ANNO,
type : nsIAnnotationService.TYPE_STRING,
flags : 0,
value : description,
expires: nsIAnnotationService.EXPIRE_NEVER };
var txn = new PlacesSetItemAnnotationTransaction(this._itemId, annoObj);
PlacesUtils.transactionManager.doTransaction(txn);
}
@@ -731,20 +731,20 @@ var gEditItemOverlay = {
* @param aLastUsed
* Whether to set or unset the LAST_USED_ANNO annotation.
* @returns an object representing the annotation which could then be used
* with the transaction manager.
*/
_getLastUsedAnnotationObject:
function EIO__getLastUsedAnnotationObject(aLastUsed) {
var anno = { name: LAST_USED_ANNO,
- type: Components.interfaces.nsIAnnotationService.TYPE_INT32,
+ type: Ci.nsIAnnotationService.TYPE_INT32,
flags: 0,
value: aLastUsed ? new Date().getTime() : null,
- expires: Components.interfaces.nsIAnnotationService.EXPIRE_NEVER };
+ expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
return anno;
},
_rebuildTagsSelectorList: function EIO__rebuildTagsSelectorList() {
var tagsSelector = this._element("tagsSelector");
var tagsSelectorRow = this._element("tagsSelectorRow");
if (tagsSelectorRow.collapsed)
@@ -803,17 +803,17 @@ var gEditItemOverlay = {
newFolder: function EIO_newFolder() {
var ip = this._folderTree.insertionPoint;
// default to the bookmarks menu folder
if (!ip || ip.itemId == PlacesUIUtils.allBookmarksFolderId) {
ip = new InsertionPoint(PlacesUtils.bookmarksMenuFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX,
- Components.interfaces.nsITreeView.DROP_ON);
+ Ci.nsITreeView.DROP_ON);
}
// XXXmano: add a separate "New Folder" string at some point...
var defaultLabel = this._element("newFolderButton").label;
var txn = new PlacesCreateFolderTransaction(defaultLabel, ip.itemId, ip.index);
PlacesUtils.transactionManager.doTransaction(txn);
this._folderTree.focus();
this._folderTree.selectItems([this._lastNewItem]);
@@ -911,19 +911,19 @@ var gEditItemOverlay = {
namePicker.value = aValue;
// clear undo stack
namePicker.editor.transactionManager.clear();
}
break;
case "uri":
var locationField = this._element("locationField");
if (locationField.value != aValue) {
- this._uri = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService)
- .newURI(aValue);
+ this._uri = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+ .newURI(aValue);
this._initTextField("locationField", this._uri.spec);
this._initNamePicker();
this._initTextField("tagsField",
PlacesUtils.tagging
.getTagsForURI(this._uri).join(", "),
false);
this._rebuildTagsSelectorList();
}
--- a/suite/common/console/consoleBindings.xml
+++ b/suite/common/console/consoleBindings.xml
@@ -146,31 +146,31 @@
]]></body>
</method>
<method name="appendItem">
<parameter name="aObject"/>
<body><![CDATA[
try {
// Try to QI it to a script error to get more info
- var scriptError = aObject.QueryInterface(Components.interfaces.nsIScriptError);
+ var scriptError = aObject.QueryInterface(Ci.nsIScriptError);
// filter chrome urls
if (!this.showChromeErrors && scriptError.sourceName.substr(0, 9) == "chrome://")
return;
// filter private windows
if (scriptError.isFromPrivateWindow)
return;
this.appendError(scriptError);
} catch (ex) {
try {
// Try to QI it to a console message
- var msg = aObject.QueryInterface(Components.interfaces.nsIConsoleMessage);
+ var msg = aObject.QueryInterface(Ci.nsIConsoleMessage);
if (msg.message)
this.appendMessage(msg.message);
else // observed a null/"clear" message
this.clearConsole();
} catch (ex2) {
// Give up and append the object itself as a string
this.appendMessage(aObject);
}
@@ -213,17 +213,17 @@
};
]]></body>
</method>
<method name="appendError">
<parameter name="aObject"/>
<body><![CDATA[
var row = this.createConsoleRow();
- var nsIScriptError = Components.interfaces.nsIScriptError;
+ var nsIScriptError = Ci.nsIScriptError;
// nsIConsoleMessage constants: debug, info, warn, error
var typetext = ["typeMessage", "typeMessage", "typeWarning", "typeError"][aObject.logLevel];
var type = ["message", "message", "warning", "error"][aObject.logLevel];
row.setAttribute("typetext", this.mStrBundle.getString(typetext));
row.setAttribute("type", type);
row.setAttribute("msg", aObject.errorMessage);
@@ -284,18 +284,18 @@
return dateServ.format(aTime);
]]></body>
</method>
<method name="copySelectedItem">
<body><![CDATA[
if (this.mSelectedItem) try {
const clipURI = "@mozilla.org/widget/clipboardhelper;1";
- const clipI = Components.interfaces.nsIClipboardHelper;
- var clipboard = Components.classes[clipURI].getService(clipI);
+ const clipI = Ci.nsIClipboardHelper;
+ var clipboard = Cc[clipURI].getService(clipI);
clipboard.copyString(this.mSelectedItem.toString());
} catch (ex) {
// Unable to copy anything, die quietly
}
]]></body>
</method>
@@ -391,20 +391,20 @@
<constructor>this.init();</constructor>
<destructor>this.destroy();</destructor>
<!-- Command controller for the copy command -->
<field name="_controller"><![CDATA[({
_outer: this,
QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIController) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIController) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
supportsCommand: function(aCommand) {
return aCommand == "cmd_copy";
},
isCommandEnabled: function(aCommand) {
return aCommand == "cmd_copy" && this._outer.selectedItem;
--- a/suite/common/contentAreaClick.js
+++ b/suite/common/contentAreaClick.js
@@ -173,17 +173,17 @@
return;
}
try {
addToUrlbarHistory(data.url);
} catch (ex) {
// Things may go wrong when adding url to session history,
// but don't let that interfere with the loading of the url.
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
if (where != "current" ||
lastLocationChange == gBrowser.selectedBrowser.lastLocationChange) {
openUILink(data.url, event,
{ ignoreButton: true,
disallowInheritPrincipal: !data.mayInheritPrincipal });
}
@@ -216,18 +216,18 @@
if (!aUrlToAdd)
return;
// Don't store bad URLs.
if (aUrlToAdd.search(/[\x00-\x1F]/) != -1)
return;
if (!gURIFixup)
- gURIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
- .getService(Components.interfaces.nsIURIFixup);
+ gURIFixup = Cc["@mozilla.org/docshell/urifixup;1"]
+ .getService(Ci.nsIURIFixup);
getShortcutOrURIAndPostData(aUrlToAdd).then(data => {
var fixedUpURI = gURIFixup.createFixupURI(data.url, 0);
if (!fixedUpURI.schemeIs("data"))
PlacesUtils.history.markPageAsTyped(fixedUpURI);
}).catch(() => {});
// Open or create the urlbar history database.
--- a/suite/common/dataman/dataman.js
+++ b/suite/common/dataman/dataman.js
@@ -56,18 +56,18 @@ var gDataman = {
Services.obs.addObserver(this, "cookie-changed");
Services.obs.addObserver(this, "perm-changed");
Services.obs.addObserver(this, "passwordmgr-storage-changed");
// Services.contentPrefs.addObserver(null, this);
Services.obs.addObserver(this, "satchel-storage-changed");
Services.obs.addObserver(this, "dom-storage-changed");
Services.obs.addObserver(this, "dom-storage2-changed");
- this.timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ this.timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
gTabs.initialize();
gDomains.initialize();
if ("arguments" in window &&
window.arguments.length >= 1 &&
window.arguments[0]) {
this.loadView(window.arguments[0])
@@ -115,22 +115,22 @@ var gDataman = {
debugMsg: function dataman_debugMsg(aLogMessage) {
if (this.debug)
Services.console.logStringMessage(aLogMessage);
},
debugError: function dataman_debugError(aLogMessage) {
if (this.debug)
- Components.utils.reportError(aLogMessage);
+ Cu.reportError(aLogMessage);
},
// :::::::::: data change observers ::::::::::
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
- Components.interfaces.nsIContentPrefObserver]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
+ Ci.nsIContentPrefObserver]),
observe: function co_observe(aSubject, aTopic, aData) {
gDataman.debugMsg("Observed: " + aTopic + " - " + aData);
switch (aTopic) {
case "cookie-changed":
gCookies.reactToChange(aSubject, aData);
break;
case "perm-changed":
@@ -283,17 +283,17 @@ var gDomains = {
gDomains.search(gDomains.searchfield.value);
yield setTimeout(nextStep, 0);
// Add domains for permissions.
gDataman.debugMsg("Add permissions to domain list: " + Date.now()/1000);
gDomains.ignoreUpdate = true;
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
- let nextPermission = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
+ let nextPermission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
if (!gDomains.commonScheme(nextPermission.principal.URI.scheme)) {
gDomains.addDomainOrFlag("*", "hasPermissions");
}
else {
gDomains.addDomainOrFlag(nextPermission.principal.URI.host.replace(/^\./, ""), "hasPermissions");
}
}
@@ -338,17 +338,17 @@ var gDomains = {
gStorage.loadList();
for (let sStorage of gStorage.storages) {
gDomains.addDomainOrFlag(sStorage.rawHost, "hasStorage");
}
gDomains.search(gDomains.searchfield.value);
// As we don't get notified of storage changes properly, reload on timer.
// The repeat time is in milliseconds, we're using 10 min for now.
gDataman.timer.initWithCallback(gDataman, 10 * 60000,
- Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
+ Ci.nsITimer.TYPE_REPEATING_SLACK);
yield setTimeout(nextStep, 0);
gDataman.debugMsg("Domain list built: " + Date.now()/1000);
gDomains.listLoadCompleted = true;
gDomains.loadView();
yield undefined;
}
@@ -945,17 +945,17 @@ var gCookies = {
},
loadList: function cookies_loadList() {
this.cookies = [];
let enumerator = Services.cookies.enumerator;
while (enumerator.hasMoreElements()) {
let nextCookie = enumerator.getNext();
if (!nextCookie) break;
- nextCookie = nextCookie.QueryInterface(Components.interfaces.nsICookie2);
+ nextCookie = nextCookie.QueryInterface(Ci.nsICookie2);
this.cookies.push(this._makeCookieObject(nextCookie));
}
},
_makeCookieObject: function cookies__makeCookieObject(aCookie) {
return {host: aCookie.host,
name: aCookie.name,
path: aCookie.path,
@@ -1056,17 +1056,17 @@ var gCookies = {
column = sortedCol.element;
else
column = document.getElementById("cookieHostCol");
}
else if (column.localName == "treecols" || column.localName == "splitter")
return;
if (!column || column.localName != "treecol") {
- Components.utils.reportError("No column found to sort cookies by");
+ Cu.reportError("No column found to sort cookies by");
return;
}
let dirAscending = column.getAttribute("sortDirection") !=
(aInvertDirection ? "ascending" : "descending");
let dirFactor = dirAscending ? 1 : -1;
// Clear attributes on all columns, we're setting them again after sorting.
@@ -1177,17 +1177,17 @@ var gCookies = {
this.sort(null, false, false);
gDataman.restoreSelectionFromIDs(this.tree, this._getObjID, selectionCache);
this.tree.treeBoxObject.endUpdateBatch();
}
return;
}
// Usual notifications for added, changed, deleted - do "surgical" updates.
- aSubject.QueryInterface(Components.interfaces.nsICookie2);
+ aSubject.QueryInterface(Ci.nsICookie2);
let domain = gDomains.getDomainFromHost(aSubject.rawHost);
// Does change affect possibly loaded Cookies pane?
let affectsLoaded = this.displayedCookies.length &&
gDomains.hostMatchesSelected(aSubject.rawHost);
if (aData == "added") {
this.cookies.push(this._makeCookieObject(aSubject));
if (affectsLoaded) {
this.displayedCookies.push(this.cookies[this.cookies.length - 1]);
@@ -1290,17 +1290,17 @@ var gPerms = {
this.addHost = document.getElementById("permHost");
this.addType = document.getElementById("permType");
this.addButton = document.getElementById("permAddButton");
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
let nextPermission = enumerator.getNext();
- nextPermission = nextPermission.QueryInterface(Components.interfaces.nsIPermission);
+ nextPermission = nextPermission.QueryInterface(Ci.nsIPermission);
if (gDomains.hostMatchesSelectedURI(nextPermission.principal.URI)) {
let permElem = document.createElement("richlistitem");
permElem.setAttribute("type", nextPermission.type);
permElem.setAttribute("host", nextPermission.principal.origin);
permElem.setAttribute("displayHost", nextPermission.principal.origin);
permElem.setAttribute("capability", nextPermission.capability);
permElem.setAttribute("class", "permission");
@@ -1508,17 +1508,17 @@ var gPerms = {
getDefault: function permissions_getDefault(aType) {
switch (aType) {
case "allowXULXBL":
return Services.perms.DENY_ACTION;
case "cookie":
if (Services.prefs.getIntPref("network.cookie.cookieBehavior") == 2)
return Services.perms.DENY_ACTION;
if (Services.prefs.getIntPref("network.cookie.lifetimePolicy") == 2)
- return Components.interfaces.nsICookiePermission.ACCESS_SESSION;
+ return Ci.nsICookiePermission.ACCESS_SESSION;
return Services.perms.ALLOW_ACTION;
case "geo":
return Services.perms.DENY_ACTION;
case "indexedDB":
return Services.perms.DENY_ACTION;
case "install":
if (Services.prefs.getBoolPref("xpinstall.whitelist.required"))
return Services.perms.DENY_ACTION;
@@ -1571,17 +1571,17 @@ var gPerms = {
if (aData == "cleared") {
gDataman.debugMsg("something has been cleared but why in permission?");
gDomains.resetFlagToDomains("hasPermissions", domainList);
return;
}
gDataman.debugMsg("react to change: " + aSubject.principal.origin + " " + aData);
- aSubject.QueryInterface(Components.interfaces.nsIPermission);
+ aSubject.QueryInterface(Ci.nsIPermission);
let rawHost;
let domain;
if (!gDomains.commonScheme(aSubject.principal.URI.scheme)) {
rawHost = "*";
domain = "*";
}
@@ -1613,17 +1613,17 @@ var gPerms = {
permElem.useDefault(true, true);
}
else {
// Only remove if domain is not shown, note that this may leave an empty domain.
let haveDomainPerms = false;
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
let nextPermission = enumerator.getNext();
- nextPermission = nextPermission.QueryInterface(Components.interfaces.nsIPermission);
+ nextPermission = nextPermission.QueryInterface(Ci.nsIPermission);
let dDomain;
if (!gDomains.commonScheme(nextPermission.principal.URI.scheme)) {
dDomain = "*";
}
else {
dDomain = gDomains.getDomainFromHost(nextPermission.principal.URI.host.replace(/^\./, ""));
@@ -1683,17 +1683,17 @@ var gPerms = {
// This function is a called when you check that all permissions for the given domain should be
// deleted (forget).
forget: function permissions_forget() {
let delPerms = [];
let enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
let nextPermission = enumerator.getNext();
- nextPermission = nextPermission.QueryInterface(Components.interfaces.nsIPermission);
+ nextPermission = nextPermission.QueryInterface(Ci.nsIPermission);
if (gDomains.hostMatchesSelectedURI(nextPermission.principal.URI)) {
delPerms.push({principal: nextPermission.principal, type: nextPermission.type});
}
}
// Loop backwards so later indexes in the list don't change.
for (let i = delPerms.length - 1; i >= 0; i--) {
@@ -1720,30 +1720,30 @@ var gPrefs = {
this.tree.treeBoxObject.beginUpdateBatch();
// Get all groups (hosts) that match the domain.
let domain = gDomains.selectedDomain.title;
if (domain == "*") {
let enumerator = Services.contentPrefs.getPrefs(null, null).enumerator;
while (enumerator.hasMoreElements()) {
- let pref = enumerator.getNext().QueryInterface(Components.interfaces.nsIProperty);
+ let pref = enumerator.getNext().QueryInterface(Ci.nsIProperty);
this.prefs.push({host: null, name: pref.name, value: pref.value});
}
}
try {
var statement = Services.contentPrefs.DBConnection.createStatement("SELECT groups.name AS host FROM groups");
while (statement.executeStep()) {
if (gDomains.hostMatchesSelected(gDomains.getDomainFromHostWithCheck(statement.row["host"]))) {
// Now, get all prefs for that host.
let enumerator = Services.contentPrefs.getPrefs(statement.row["host"], null).enumerator;
while (enumerator.hasMoreElements()) {
- let pref = enumerator.getNext().QueryInterface(Components.interfaces.nsIProperty);
+ let pref = enumerator.getNext().QueryInterface(Ci.nsIProperty);
this.prefs.push({host: statement.row["host"],
displayHost: gLocSvc.idn.convertToDisplayIDN(statement.row["host"], {}),
name: pref.name,
value: pref.value});
}
}
}
}
@@ -1794,17 +1794,17 @@ var gPrefs = {
column = sortedCol.element;
else
column = document.getElementById("prefsHostCol");
}
else if (column.localName == "treecols" || column.localName == "splitter")
return;
if (!column || column.localName != "treecol") {
- Components.utils.reportError("No column found to sort form data by");
+ Cu.reportError("No column found to sort form data by");
return;
}
let dirAscending = column.getAttribute("sortDirection") !=
(aInvertDirection ? "ascending" : "descending");
let dirFactor = dirAscending ? 1 : -1;
// Clear attributes on all columns, we're setting them again after sorting.
@@ -1971,30 +1971,30 @@ var gPrefs = {
forget: function prefs_forget() {
let delPrefs = [];
try {
// Get all groups (hosts) that match the domain.
let domain = gDomains.selectedDomain.title;
if (domain == "*") {
let enumerator = Services.contentPrefs.getPrefs(null, null).enumerator;
while (enumerator.hasMoreElements()) {
- let pref = enumerator.getNext().QueryInterface(Components.interfaces.nsIProperty);
+ let pref = enumerator.getNext().QueryInterface(Ci.nsIProperty);
delPrefs.push({host: null, name: pref.name, value: pref.value});
}
}
let sql = "SELECT groups.name AS host FROM groups";
var statement = Services.contentPrefs.DBConnection.createStatement(sql);
while (statement.executeStep()) {
if (gDomains.hostMatchesSelected(gDomains.getDomainFromHostWithCheck(statement.row["host"]))) {
// Now, get all prefs for that host.
let enumerator = Services.contentPrefs.getPrefs(statement.row["host"], null).enumerator;
while (enumerator.hasMoreElements()) {
- let pref = enumerator.getNext().QueryInterface(Components.interfaces.nsIProperty);
+ let pref = enumerator.getNext().QueryInterface(Ci.nsIProperty);
delPrefs.push({host: statement.row["host"], name: pref.name, value: pref.value});
}
}
}
}
finally {
statement.reset();
}
@@ -2101,17 +2101,17 @@ var gPasswords = {
column = sortedCol.element;
else
column = document.getElementById("pwdHostCol");
}
else if (column.localName == "treecols" || column.localName == "splitter")
return;
if (!column || column.localName != "treecol") {
- Components.utils.reportError("No column found to sort form data by");
+ Cu.reportError("No column found to sort form data by");
return;
}
let dirAscending = column.getAttribute("sortDirection") !=
(aInvertDirection ? "ascending" : "descending");
let dirFactor = dirAscending ? 1 : -1;
// Clear attributes on all columns, we're setting them again after sorting.
@@ -2194,18 +2194,18 @@ var gPasswords = {
"pwd.hidePasswords.accesskey" :
"pwd.showPasswords.accesskey");
this.pwdCol.hidden = !this.showPasswords;
}
},
_confirmShowPasswords: function passwords__confirmShowPasswords() {
// This doesn't harm if passwords are not encrypted.
- let tokendb = Components.classes["@mozilla.org/security/pk11tokendb;1"]
- .createInstance(Components.interfaces.nsIPK11TokenDB);
+ let tokendb = Cc["@mozilla.org/security/pk11tokendb;1"]
+ .createInstance(Ci.nsIPK11TokenDB);
let token = tokendb.getInternalKeyToken();
// If there is no master password, still give the user a chance to opt-out
// of displaying passwords
if (token.checkPassword(""))
return this._askUserShowPasswords();
// So there's a master password. But since checkPassword didn't succeed,
@@ -2245,19 +2245,19 @@ var gPasswords = {
// Copy selected signon's password to clipboard.
let row = this.tree.currentIndex;
let password = gPasswords.displayedSignons[row].password;
gLocSvc.clipboard.copyString(password);
},
copyPassword: function passwords_copyPassword() {
// Prompt for the master password upfront.
- let token = Components.classes["@mozilla.org/security/pk11tokendb;1"]
- .getService(Components.interfaces.nsIPK11TokenDB)
- .getInternalKeyToken();
+ let token = Cc["@mozilla.org/security/pk11tokendb;1"]
+ .getService(Ci.nsIPK11TokenDB)
+ .getInternalKeyToken();
if (this.showPasswords || token.checkPassword(""))
this.copySelPassword();
else {
try {
token.login(true);
this.copySelPassword();
} catch (ex) {
@@ -2291,32 +2291,32 @@ var gPasswords = {
}
gDomains.resetFlagToDomains("hasPasswords", domainList);
return;
}
// Usual notifications for addLogin, modifyLogin, removeLogin - do "surgical" updates.
let curLogin = null, oldLogin = null;
if (aData == "modifyLogin" &&
- aSubject instanceof Components.interfaces.nsIArray) {
+ aSubject instanceof Ci.nsIArray) {
let enumerator = aSubject.enumerate();
if (enumerator.hasMoreElements()) {
oldLogin = enumerator.getNext();
- oldLogin.QueryInterface(Components.interfaces.nsILoginInfo);
+ oldLogin.QueryInterface(Ci.nsILoginInfo);
}
if (enumerator.hasMoreElements()) {
curLogin = enumerator.getNext();
- curLogin.QueryInterface(Components.interfaces.nsILoginInfo);
+ curLogin.QueryInterface(Ci.nsILoginInfo);
}
}
- else if (aSubject instanceof Components.interfaces.nsILoginInfo) {
+ else if (aSubject instanceof Ci.nsILoginInfo) {
curLogin = aSubject; oldLogin = aSubject;
}
else {
- Components.utils.reportError("Observed an unrecognized signon change of type " + aData);
+ Cu.reportError("Observed an unrecognized signon change of type " + aData);
}
let domain = gDomains.getDomainFromHost(curLogin.hostname);
// Does change affect possibly loaded Passwords pane?
let affectsLoaded = this.displayedSignons.length &&
gDomains.hostMatchesSelected(curLogin.hostname);
if (aData == "addLogin") {
this.allSignons.push(curLogin);
@@ -2455,24 +2455,24 @@ var gStorage = {
type: "appCache",
size: cache.usage,
groupID: lGroup});
}
// Load DOM storage entries, unfortunately need to go to the DB. :(
// Bug 343163 would make this easier and clean.
let domstorelist = [];
- let file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("ProfD", Components.interfaces.nsIFile);
+ let file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("ProfD", Ci.nsIFile);
file.append("webappsstore.sqlite");
if (file.exists()) {
- var connection = Components.classes["@mozilla.org/storage/service;1"]
- .getService(Components.interfaces.mozIStorageService)
- .openDatabase(file);
+ var connection = Cc["@mozilla.org/storage/service;1"]
+ .getService(Ci.mozIStorageService)
+ .openDatabase(file);
try {
if (connection.tableExists("webappsstore2")) {
var statement =
connection.createStatement("SELECT scope, key FROM webappsstore2");
while (statement.executeStep())
domstorelist.push({scope: statement.getString(0),
key: statement.getString(1)});
statement.reset();
@@ -2525,27 +2525,27 @@ var gStorage = {
origHost: origHost,
keys: [domstorelist[i].key]});
}
}
}
// Load indexedDB entries, unfortunately need to read directory for now. :(
// Bug 630858 would make this easier and clean.
- let dir = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("ProfD", Components.interfaces.nsIFile);
+ let dir = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("ProfD", Ci.nsIFile);
dir.append("indexedDB");
if (dir.exists() && dir.isDirectory()) {
// Enumerate subdir entries, names are like "http+++davidflanagan.com" or
// "https+++mochi.test+8888", and filter out the domain name and protocol
// from that.
// gLocSvc.idxdbmgr is usable as soon as we have a URI.
let files = dir.directoryEntries
- .QueryInterface(Components.interfaces.nsIDirectoryEnumerator);
+ .QueryInterface(Ci.nsIDirectoryEnumerator);
gDataman.debugMsg("Loading IndexedDB entries");
while (files.hasMoreElements()) {
let file = files.nextFile;
// Convert directory name to a URI.
let host = file.leafName.replace(/\+\+\+/, "://").replace(/\+(\d+)$/, ":$1");
let uri = Services.io.newURI(host);
this.storages.push({host: host,
@@ -2598,17 +2598,17 @@ var gStorage = {
column = sortedCol.element;
else
column = document.getElementById("storageHostCol");
}
else if (column.localName == "treecols" || column.localName == "splitter")
return;
if (!column || column.localName != "treecol") {
- Components.utils.reportError("No column found to sort form data by");
+ Cu.reportError("No column found to sort form data by");
return;
}
let dirAscending = column.getAttribute("sortDirection") !=
(aInvertDirection ? "ascending" : "descending");
let dirFactor = dirAscending ? 1 : -1;
// Clear attributes on all columns, we're setting them again after sorting.
@@ -2748,17 +2748,17 @@ var gStorage = {
// session storage also comes here, but currently not supported
// aData: null, all data in aSubject
// see https://developer.mozilla.org/en/DOM/Event/StorageEvent
switch (aData) {
case "localStorage":
case "sessionStorage":
break;
default:
- Components.utils.reportError("Observed an unrecognized storage change of type " + aData);
+ Cu.reportError("Observed an unrecognized storage change of type " + aData);
}
gDataman.debugMsg("Found storage event for: " + aData);
},
forget: function storage_forget() {
// Loop backwards so later indexes in the list don't change.
for (let i = this.storages.length - 1; i >= 0; i--) {
@@ -2829,17 +2829,17 @@ var gFormdata = {
timesUsed: result.timesUsed,
firstUsed: gFormdata._getTimeString(result.firstUsed),
firstUsedSortValue: result.firstUsed,
lastUsed: gFormdata._getTimeString(result.lastUsed),
lastUsedSortValue: result.lastUsed,
guid: result.guid});
},
handleError(aError) {
- Components.utils.reportError(aError);
+ Cu.reportError(aError);
},
handleCompletion(aReason) {
// This needs to stay in or Async.promiseSpinningly will fail.
resolve();
}
};
gLocSvc.FormHistory.search(["fieldname", "value", "timesUsed", "firstUsed", "lastUsed", "guid"],
{},
@@ -2903,17 +2903,17 @@ var gFormdata = {
column = sortedCol.element;
else
column = document.getElementById("fdataFieldCol");
}
else if (column.localName == "treecols" || column.localName == "splitter")
return;
if (!column || column.localName != "treecol") {
- Components.utils.reportError("No column found to sort form data by");
+ Cu.reportError("No column found to sort form data by");
return;
}
let dirAscending = column.getAttribute("sortDirection") !=
(aInvertDirection ? "ascending" : "descending");
let dirFactor = dirAscending ? 1 : -1;
// Clear attributes on all columns, we're setting them again after sorting.
@@ -3035,17 +3035,17 @@ var gFormdata = {
let callbacks = {
handleResult(result) {
// There can be only one entry for a given guid.
// If there are more we will not behead it but instead
// only keep the last returned result.
entry = result;
},
handleError(aError) {
- Components.utils.reportError(aError);
+ Cu.reportError(aError);
reject(error);
},
handleCompletion(aReason) {
resolve(entry);
}
};
gLocSvc.FormHistory.search(["fieldname", "value", "timesUsed", "firstUsed", "lastUsed", "guid"],
@@ -3083,49 +3083,49 @@ var gFormdata = {
this.loadList();
this.search("");
return;
}
if (aData != "formhistory-add" && aData != "formhistory-change" &&
aData != "formhistory-remove") {
- Components.utils.reportError("Observed an unrecognized formdata change of type " + aData);
+ Cu.reportError("Observed an unrecognized formdata change of type " + aData);
return;
}
var cGuid = null;
- if (aSubject instanceof Components.interfaces.nsISupportsString) {
+ if (aSubject instanceof Ci.nsISupportsString) {
cGuid = aSubject.toString();
}
if (!cGuid) {
// See bug 1346850. Remove has a problem and always sends a null guid.
// We just let the panel stay the same which might cause minor problems
// because there is no longer a notification when removing all entries.
if (aData != "formhistory-remove") {
- Components.utils.reportError("FormHistory guid is null for " + aData);
+ Cu.reportError("FormHistory guid is null for " + aData);
}
return;
}
var entryData = null;
if (aData == "formhistory-add" || aData == "formhistory-change") {
// Use Async.promiseSpinningly to Sync the call.
Async.promiseSpinningly(this._promiseReadFormHistory(cGuid).then(entry => {
if (entry) {
entryData = entry;
}
return;
}));
if (!entryData) {
- Components.utils.reportError("Could not find added/modifed formdata entry");
+ Cu.reportError("Could not find added/modifed formdata entry");
return;
}
}
if (aData == "formhistory-add") {
this.formdata.push(entryData);
this.displayedFormdata.push(this.formdata[this.formdata.length - 1]);
this.tree.treeBoxObject.rowCountChanged(this.formdata.length - 1, 1);
--- a/suite/common/dataman/tests/browser_dataman_basics.js
+++ b/suite/common/dataman/tests/browser_dataman_basics.js
@@ -1,20 +1,20 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Test basic functionality of the data manager.
// Happens to match what's used in Data Manager itself.
var gLocSvc = {
- fhist: Components.classes["@mozilla.org/satchel/form-history;1"]
- .getService(Components.interfaces.nsIFormHistory2),
- idn: Components.classes["@mozilla.org/network/idn-service;1"]
- .getService(Components.interfaces.nsIIDNService),
+ fhist: Cc["@mozilla.org/satchel/form-history;1"]
+ .getService(Ci.nsIFormHistory2),
+ idn: Cc["@mozilla.org/network/idn-service;1"]
+ .getService(Ci.nsIIDNService),
};
const DATAMAN_LOADED = "dataman-loaded";
const TEST_DONE = "dataman-test-done";
const kPreexistingDomains = 13;
function test() {
@@ -57,28 +57,28 @@ function test() {
gLocSvc.fhist.addEntry("akey", "value0");
gLocSvc.fhist.addEntry("ekey", "value1");
gLocSvc.fhist.addEntry("ekey", "value2");
gLocSvc.fhist.addEntry("bkey", "value3");
gLocSvc.fhist.addEntry("bkey", "value4");
gLocSvc.fhist.addEntry("ckey", "value5");
// Add a few passwords
- let loginInfo1 = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
- .createInstance(Components.interfaces.nsILoginInfo);
+ let loginInfo1 = Cc["@mozilla.org/login-manager/loginInfo;1"]
+ .createInstance(Ci.nsILoginInfo);
loginInfo1.init("http://www.geckoisgecko.org", "http://www.geckoisgecko.org", null,
"dataman", "mysecret", "user", "pwd");
Services.logins.addLogin(loginInfo1);
- let loginInfo2 = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
- .createInstance(Components.interfaces.nsILoginInfo);
+ let loginInfo2 = Cc["@mozilla.org/login-manager/loginInfo;1"]
+ .createInstance(Ci.nsILoginInfo);
loginInfo2.init("gopher://geckoisgecko.org:4711", null, "foo",
"dataman", "mysecret", "", "");
Services.logins.addLogin(loginInfo2);
- let loginInfo3 = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
- .createInstance(Components.interfaces.nsILoginInfo);
+ let loginInfo3 = Cc["@mozilla.org/login-manager/loginInfo;1"]
+ .createInstance(Ci.nsILoginInfo);
loginInfo3.init("https://[::1]", null, "foo",
"dataman", "mysecret", "", "");
Services.logins.addLogin(loginInfo3);
//Services.prefs.setBoolPref("data_manager.debug", true);
gBrowser.addTab();
// Open the Data Manager, testing the menu item.
@@ -318,17 +318,17 @@ function test_cookies_panel(aWin) {
function test_permissions_panel(aWin) {
aWin.gDomains.tree.view.selection.select(8);
is(aWin.gDomains.selectedDomain.title, "getpersonas.com",
"For permissions tests, correct domain is selected");
is(aWin.gTabs.activePanel, "permissionsPanel",
"Permissions panel is selected");
Services.perms.add(Services.io.newURI("http://cookie.getpersonas.com/"),
- "cookie", Components.interfaces.nsICookiePermission.ACCESS_SESSION);
+ "cookie", Ci.nsICookiePermission.ACCESS_SESSION);
Services.perms.add(Services.io.newURI("http://cookie2.getpersonas.com/"),
"cookie", Services.perms.DENY_ACTION);
Services.perms.add(Services.io.newURI("http://geo.getpersonas.com/"),
"geo", Services.perms.ALLOW_ACTION);
Services.perms.add(Services.io.newURI("http://image.getpersonas.com/"),
"image", Services.perms.DENY_ACTION);
Services.perms.add(Services.io.newURI("http://indexedDB.getpersonas.com/"),
"indexedDB", Services.perms.ALLOW_ACTION);
@@ -752,18 +752,18 @@ function test_idn(aWin) {
"Correct domain displayed for utf8 IDN preference");
aWin.gPrefs.tree.view.selection.select(0);
aWin.document.getElementById("prefsRemove").click();
aWin.document.getElementById("prefsRemove").click();
is(aWin.gTabs.activePanel, "permissionsPanel",
"After deleting, correctly switched back to permissions panel");
// Add IDN password (usually have encoded names)
- let loginInfo1 = Components.classes["@mozilla.org/login-manager/loginInfo;1"]
- .createInstance(Components.interfaces.nsILoginInfo);
+ let loginInfo1 = Cc["@mozilla.org/login-manager/loginInfo;1"]
+ .createInstance(Ci.nsILoginInfo);
loginInfo1.init("http://" + idnDomain, "http://" + idnDomain, null,
"dataman", "mysecret", "user", "pwd");
Services.logins.addLogin(loginInfo1);
aWin.gTabs.tabbox.selectedTab = aWin.document.getElementById("passwordsTab");
is(aWin.gTabs.activePanel, "passwordsPanel",
"Successfully switched to passwords panel for IDN tests");
is(aWin.gPasswords.tree.view.getCellText(0, aWin.gPasswords.tree.columns["pwdHostCol"]),
"http://" + idnDomain,
--- a/suite/common/defaultClientDialog.js
+++ b/suite/common/defaultClientDialog.js
@@ -1,21 +1,21 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// this dialog can only be opened if we have a shell service
-const nsIShellService = Components.interfaces.nsIShellService;
-const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
+const nsIShellService = Ci.nsIShellService;
+const nsIPrefBranch = Ci.nsIPrefBranch;
function onLoad()
{
- var shellSvc = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ var shellSvc = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
var defaultList = document.getElementById("defaultList");
var appTypes = shellSvc.shouldBeDefaultClientFor;
/* Iterate through the list of possible default client types and check for
each list item if we want to be the default for that type using the AND
conjunction */
for (var i = 0; i < defaultList.getRowCount(); i++) {
var currentItem = defaultList.getItemAtIndex(i);
try {
@@ -29,18 +29,18 @@ function onLoad()
currentItem.hidden = true;
}
}
}
function onAccept()
{
// for each checked item, if we aren't already the default, make us the default.
- var shellSvc = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ var shellSvc = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
var appTypes = 0;
var appTypesCheck = 0;
var defaultList = document.getElementById("defaultList");
for (var i = 0; i < defaultList.getRowCount(); i++) {
var currentItem = defaultList.getItemAtIndex(i);
var currentAppType = nsIShellService[currentItem.value];
--- a/suite/common/downloads/downloadmanager.js
+++ b/suite/common/downloads/downloadmanager.js
@@ -1,18 +1,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
ChromeUtils.import("resource://gre/modules/Downloads.jsm");
-const nsIDownloadManager = Components.interfaces.nsIDownloadManager;
+const nsIDownloadManager = Ci.nsIDownloadManager;
const nsLocalFile = Components.Constructor("@mozilla.org/file/local;1",
- Components.interfaces.nsIFile,
+ Ci.nsIFile,
"initWithPath");
var gDownloadTree;
var gDownloadTreeView;
var gDownloadList;
var gDownloadStatus;
var gDownloadListener;
var gSearchBox;
@@ -154,18 +154,18 @@ function openDownload(aDownload)
if (file.isExecutable()) {
var alertOnEXEOpen = GetBoolPref("browser.download.manager.alertOnEXEOpen",
true);
// On Windows 7 and above, we rely on native security prompting for
// downloaded content unless it's disabled.
try {
- var sysInfo = Components.classes["@mozilla.org/system-info;1"]
- .getService(Components.interfaces.nsIPropertyBag2);
+ var sysInfo = Cc["@mozilla.org/system-info;1"]
+ .getService(Ci.nsIPropertyBag2);
if (/^Windows/.test(sysInfo.getProperty("name")) &&
Services.prefs.getBoolPref("browser.download.manager.scanWhenDone"))
alertOnEXEOpen = false;
} catch (ex) { }
if (alertOnEXEOpen) {
var dlbundle = document.getElementById("dmBundle");
var message = dlbundle.getFormattedString("fileExecutableSecurityWarning", [name, name]);
@@ -189,43 +189,43 @@ function openDownload(aDownload)
} catch (ex) { }
try {
file.launch();
} catch (ex) {
// If launch fails, try sending it through the system's external
// file: URL handler
var uri = Services.io.newFileURI(file);
- var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ var protocolSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
protocolSvc.loadURI(uri);
}
}
function showDownload(aDownload)
{
var file = new nsLocalFile(aDownload.target.path);
try {
// Show the directory containing the file and select the file
file.reveal();
} catch (e) {
// If reveal fails for some reason (e.g., it's not implemented on unix or
// the file doesn't exist), try using the parent if we have it.
- var parent = file.parent.QueryInterface(Components.interfaces.nsIFile);
+ var parent = file.parent.QueryInterface(Ci.nsIFile);
try {
// "Double click" the parent directory to show where the file should be
parent.launch();
} catch (e) {
// If launch also fails (probably because it's not implemented), let the
// OS handler try to open the parent
var uri = Services.io.newFileURI(parent);
- var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ var protocolSvc = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
protocolSvc.loadURI(uri);
}
}
}
function showProperties(aDownload)
{
openDialog("chrome://communicator/content/downloads/progressDialog.xul",
@@ -349,30 +349,30 @@ function onUpdateProgress()
// Get the correct plural form and insert number of downloads and percent
title = PluralForm.get(numActiveDownloads, title);
document.title = title;
}
}
function handlePaste() {
- let trans = Components.classes["@mozilla.org/widget/transferable;1"]
- .createInstance(Components.interfaces.nsITransferable);
+ let trans = Cc["@mozilla.org/widget/transferable;1"]
+ .createInstance(Ci.nsITransferable);
trans.init(null);
let flavors = ["text/x-moz-url", "text/unicode"];
flavors.forEach(trans.addDataFlavor);
Services.clipboard.getData(trans, Services.clipboard.kGlobalClipboard);
// Getting the data or creating the nsIURI might fail
try {
let data = {};
trans.getAnyTransferData({}, data, {});
- let [url, name] = data.value.QueryInterface(Components.interfaces
+ let [url, name] = data.value.QueryInterface(Ci
.nsISupportsString).data.split("\n");
if (!url)
return;
DownloadURL(url, name || url, document);
} catch (ex) {}
}
@@ -554,18 +554,18 @@ var dlTreeController = {
break;
case "cmd_show":
showDownload(selItemData[0]);
break;
case "cmd_openReferrer":
openUILink(selItemData[0].referrer);
break;
case "cmd_copyLocation":
- var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper);
var uris = [];
for (let dldata of selItemData)
uris.push(dldata.source.url);
clipboard.copyString(uris.join("\n"), document);
break;
case "cmd_properties":
showProperties(selItemData[0]);
break;
@@ -669,10 +669,10 @@ var gDownloadDNDObserver = {
}
};
function disallowDrop(aEvent)
{
var dt = aEvent.dataTransfer;
var file = dt.mozGetDataAt("application/x-moz-file", 0);
// If this is a local file, Don't try to download it again.
- return file && file instanceof Components.interfaces.nsIFile;
+ return file && file instanceof Ci.nsIFile;
}
--- a/suite/common/downloads/progressDialog.js
+++ b/suite/common/downloads/progressDialog.js
@@ -283,18 +283,18 @@ var ProgressDlgController = {
break;
case "cmd_show":
showDownload(gDownload);
break;
case "cmd_openReferrer":
openUILink(gDownload.referrer.spec);
break;
case "cmd_copyLocation":
- var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper);
clipboard.copyString(gDownload.source.spec);
break;
}
},
onEvent: function(aEvent) {
},
--- a/suite/common/downloads/tests/browser/browser_nsISuiteDownloadManagerUI.js
+++ b/suite/common/downloads/tests/browser/browser_nsISuiteDownloadManagerUI.js
@@ -1,24 +1,24 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function test_visibility_open()
{
- var dmui = Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI);
+ var dmui = Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI);
isnot(dmui.recentWindow, null,
"nsIDownloadManagerUI indicates that the UI is visible");
}
function test_visibility_closed(aWin)
{
- var dmui = Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI);
+ var dmui = Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI);
function dmWindowClosedListener() {
aWin.removeEventListener("unload", dmWindowClosedListener);
is(dmui.recentWindow, null,
"nsIDownloadManagerUI indicates that the UI is not visible");
finish();
}
aWin.addEventListener("unload", dmWindowClosedListener);
@@ -28,34 +28,34 @@ function test_visibility_closed(aWin)
var testFuncs = [
test_visibility_open
, test_visibility_closed /* all tests after this *must* expect there to be
no open window, otherwise they will fail! */
];
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// First, we populate the database with some fake data
db.executeSimpleSQL("DELETE FROM moz_downloads");
// See if the DM is already open, and if it is, close it!
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win)
win.close();
// OK, now that all the data is in, let's pull up the UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI).showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI).showManager();
- let obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ let obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
let testObs = {
observe: function(aSubject, aTopic, aData) {
obs.removeObserver(testObs, DLMGR_UI_DONE);
var win = wm.getMostRecentWindow("Download:Manager");
// Now we can run our tests
--- a/suite/common/downloads/tests/chrome/test_action_keys_respect_focus.xul
+++ b/suite/common/downloads/tests/chrome/test_action_keys_respect_focus.xul
@@ -107,124 +107,124 @@ keyPressObs.prototype = {
};
var searchAndPressKey = function(aKey, aWin, aValue) {
var searchbox = aWin.document.getElementById("search-box");
searchbox.focus();
if (aValue != null)
searchbox.value = aValue;
// Press given key after a short delay to allow focus() to complete
- var timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ var timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
timer.init(new keyPressObs(aWin, aKey), 500,
- Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ Ci.nsITimer.TYPE_ONE_SHOT);
}
function dlObs(aWin)
{
this.mWin = aWin;
this.wasPaused = false;
this.wasResumed = false;
this.wasFinished = false;
}
dlObs.prototype = {
onDownloadStateChange: function(aState, aDownload)
{
- if (aDownload.state == Components.interfaces.nsIDownloadManager.DOWNLOAD_DOWNLOADING &&
+ if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING &&
!this.wasPaused)
{
this.wasPaused = true;
this.mWin.pauseDownload(aDownload.id);
return;
}
var searchbox = this.mWin.document.getElementById("search-box");
- if (aDownload.state == Components.interfaces.nsIDownloadManager.DOWNLOAD_PAUSED &&
+ if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_PAUSED &&
!this.wasResumed)
{
this.wasResumed = true;
// Fill Search with an added space (test continues in testObs)
backupTestedFunction("resumeDownload", this.mWin);
searchAndPressKey(" ", this.mWin, "paused");
} else
- if (aDownload.state == Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED &&
+ if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_FINISHED &&
!this.wasFinished)
{
this.wasFinished = true;
// The formerly paused download was resumed successfully, is now complete
// and still selected. Since it is a real download it can be opened.
// Init Search (test continues in testObs)
backupTestedFunction("openDownload", this.mWin);
searchAndPressKey("VK_RETURN", this.mWin, "delete me");
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
dm.removeListener(this);
}
},
onStateChange: function(a, b, c, d, e) { },
onProgressChange: function(a, b, c, d, e, f, g) { },
onSecurityChange: function(a, b, c, d) { }
};
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
function addDownload()
{
function createURI(aObj)
{
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- return (aObj instanceof Components.interfaces.nsIFile) ? ios.newFileURI(aObj) :
+ var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+ return (aObj instanceof Ci.nsIFile) ? ios.newFileURI(aObj) :
ios.newURI(aObj);
}
- const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
- var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
- .createInstance(nsIWBP);
+ const nsIWBP = Ci.nsIWebBrowserPersist;
+ var persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
+ .createInstance(nsIWBP);
persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
- var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties);
- var destFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
+ var dirSvc = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties);
+ var destFile = dirSvc.get("ProfD", Ci.nsIFile);
// The "paused" part of this filename will be searched for later.
destFile.append("download.paused");
if (destFile.exists())
destFile.remove(false);
- var dl = dm.addDownload(Components.interfaces.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
+ var dl = dm.addDownload(Ci.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
createURI("http://example.com/httpd.js"),
createURI(destFile), null, null,
Math.round(Date.now() * 1000), null, persist, false);
- persist.progressListener = dl.QueryInterface(Components.interfaces.nsIWebProgressListener);
+ persist.progressListener = dl.QueryInterface(Ci.nsIWebProgressListener);
persist.saveURI(dl.source, null, null, 0, null, null, dl.targetFile, null);
return dl;
}
// Empty any old downloads
dm.DBConnection.executeSimpleSQL("DELETE FROM moz_downloads");
// Make a file name for the downloads
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append("cleanUp");
- var filePath = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService)
- .newFileURI(file).spec;
+ var filePath = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+ .newFileURI(file).spec;
var stmt = dm.DBConnection.createStatement(
"INSERT INTO moz_downloads (name, target, source, state) " +
"VALUES (?1, ?2, ?3, ?4)");
try {
for (let site of ["delete.me", "i.live"]) {
stmt.bindByIndex(0, "Finished Download");
@@ -240,22 +240,22 @@ function test()
stmt.reset();
stmt.finalize();
}
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
- const IS_MAC = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULRuntime)
- .OS == "Darwin";
+ const IS_MAC = Cc["@mozilla.org/xre/app-info;1"]
+ .getService(Ci.nsIXULRuntime)
+ .OS == "Darwin";
var testPhase = 0;
var testObs = {
observe: function(aSubject, aTopic, aData)
{
if (aTopic != DLMGR_UI_DONE)
return;
@@ -364,19 +364,19 @@ function test()
break;
}
}
obs.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_basic_functionality.xul
+++ b/suite/common/downloads/tests/chrome/test_basic_functionality.xul
@@ -51,105 +51,105 @@
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript">
<![CDATA[
-var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
-var dmFile = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+var dmFile = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
dmFile.append("dm-ui-test.file");
-dmFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
+dmFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var gTestPath = ios.newFileURI(dmFile).spec;
// Downloads are sorted by endTime, so make sure the end times are distinct
const DownloadData = [
/* Active states first */
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859239,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_NOTSTARTED,
+ state: Ci.nsIDownloadManager.DOWNLOAD_NOTSTARTED,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859238,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_DOWNLOADING,
+ state: Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859237,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_PAUSED,
+ state: Ci.nsIDownloadManager.DOWNLOAD_PAUSED,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859236,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_SCANNING,
+ state: Ci.nsIDownloadManager.DOWNLOAD_SCANNING,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859235,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_QUEUED,
+ state: Ci.nsIDownloadManager.DOWNLOAD_QUEUED,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
/* Finished states */
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859234,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED,
+ state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859233,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_FAILED,
+ state: Ci.nsIDownloadManager.DOWNLOAD_FAILED,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859232,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_CANCELED,
+ state: Ci.nsIDownloadManager.DOWNLOAD_CANCELED,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859231,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_BLOCKED_PARENTAL,
+ state: Ci.nsIDownloadManager.DOWNLOAD_BLOCKED_PARENTAL,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859230,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_DIRTY,
+ state: Ci.nsIDownloadManager.DOWNLOAD_DIRTY,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859229,
endTime: 1180493839859229,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_BLOCKED_POLICY,
+ state: Ci.nsIDownloadManager.DOWNLOAD_BLOCKED_POLICY,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 }
];
function test_numberOfTreeItems(aWin)
{
var doc = aWin.document;
var dlTree = doc.getElementById("downloadTree");
is(dlTree.view.rowCount, DownloadData.length,
@@ -163,72 +163,72 @@ function test_properDownloadData(aWin)
var dlTree = doc.getElementById("downloadTree");
var view = dlTree.view;
var colName = dlTree.columns.getNamedColumn("Name");
var colState = dlTree.columns.getNamedColumn("Status");
var colTarget = dlTree.columns.getNamedColumn("Name");
var colSource = dlTree.columns.getNamedColumn("Source");
var stateString;
var statusBar = doc.getElementById("statusbar-display");
- var ioSvc = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ioSvc = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
for (var i = 0; i < view.rowCount; i++) {
view.selection.select(i);
is(view.getCellText(i, colName), DownloadData[i].name,
"Download names match up");
switch (DownloadData[i].state) {
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_PAUSED:
+ case Ci.nsIDownloadManager.DOWNLOAD_PAUSED:
stateString = "Paused";
break;
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_DOWNLOADING:
+ case Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING:
stateString = "Downloading";
break;
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED:
+ case Ci.nsIDownloadManager.DOWNLOAD_FINISHED:
stateString = "Finished";
break;
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_FAILED:
+ case Ci.nsIDownloadManager.DOWNLOAD_FAILED:
stateString = "Failed";
break;
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_CANCELED:
+ case Ci.nsIDownloadManager.DOWNLOAD_CANCELED:
stateString = "Canceled";
break;
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_BLOCKED_PARENTAL: // Parental Controls
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_BLOCKED_POLICY: // Security Zone Policy
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_DIRTY: // possible virus/spyware
+ case Ci.nsIDownloadManager.DOWNLOAD_BLOCKED_PARENTAL: // Parental Controls
+ case Ci.nsIDownloadManager.DOWNLOAD_BLOCKED_POLICY: // Security Zone Policy
+ case Ci.nsIDownloadManager.DOWNLOAD_DIRTY: // possible virus/spyware
stateString = "Blocked";
break;
default:
stateString = "Not Started";
break;
}
is(view.getCellText(i, colState), stateString,
"Download states match up");
var filePath = ioSvc.newURI(DownloadData[i].target)
- .QueryInterface(Components.interfaces.nsIFileURL)
+ .QueryInterface(Ci.nsIFileURL)
.file.clone()
- .QueryInterface(Components.interfaces.nsIFile)
+ .QueryInterface(Ci.nsIFile)
.path;
is(statusBar.label, filePath,
"Download targets match up");
is(view.getCellText(i, colSource), DownloadData[i].source,
"Download sources match up");
}
}
var testFuncs = [
test_numberOfTreeItems
, test_properDownloadData
];
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// First, we populate the database with some fake data
db.executeSimpleSQL("DELETE FROM moz_downloads");
var stmt = db.createStatement(
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
"state, currBytes, maxBytes, preferredAction, autoResume) " +
"VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
@@ -241,18 +241,18 @@ function test()
}
stmt.finalize();
// See if the DM is already open, and if it is, close it!
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win)
win.close();
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testObs = {
observe: function(aSubject, aTopic, aData)
{
if (aTopic != DLMGR_UI_DONE)
return;
@@ -268,19 +268,19 @@ function test()
SimpleTest.finish();
}
};
// Register with the observer service
os.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_cleanup_search.xul
+++ b/suite/common/downloads/tests/chrome/test_cleanup_search.xul
@@ -54,31 +54,31 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript">
<![CDATA[
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// Empty any old downloads
db.executeSimpleSQL("DELETE FROM moz_downloads");
// Make a file name for the downloads
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append("cleanUp");
- var filePath = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService)
- .newFileURI(file).spec;
+ var filePath = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+ .newFileURI(file).spec;
var stmt = db.createStatement(
"INSERT INTO moz_downloads (name, target, source, state) " +
"VALUES (?1, ?2, ?3, ?4)");
try {
for (let site of ["delete.me", "i.live"]) {
stmt.bindByIndex(0, "Super Pimped Download");
@@ -94,18 +94,18 @@ function test()
stmt.reset();
stmt.finalize();
}
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testPhase = 0;
var testObs = {
observe: function(aSubject, aTopic, aData) {
if (aTopic != DLMGR_UI_DONE)
return;
@@ -155,19 +155,19 @@ function test()
break;
}
}
};
obs.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_clear_button_disabled.xul
+++ b/suite/common/downloads/tests/chrome/test_clear_button_disabled.xul
@@ -55,24 +55,24 @@
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript">
<![CDATA[
-const nsIDownloadManager = Components.interfaces.nsIDownloadManager;
-var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
-var dmFile = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+const nsIDownloadManager = Ci.nsIDownloadManager;
+var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+var dmFile = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
dmFile.append("dm-ui-test.file");
-dmFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
+dmFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var gTestPath = ios.newFileURI(dmFile).spec;
const DoneDownloadData = [
{ name: "Dead",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859239,
@@ -87,18 +87,18 @@ const ActiveDownloadData = [
startTime: 1180493839859230,
endTime: 1180493839859239,
state: nsIDownloadManager.DOWNLOAD_DOWNLOADING,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 }
];
function runTest()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// Empty any old downloads
db.executeSimpleSQL("DELETE FROM moz_downloads");
var stmt = db.createStatement(
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
"state, currBytes, maxBytes, preferredAction, autoResume) " +
@@ -111,18 +111,18 @@ function runTest()
stmt.execute();
}
//stmt.finalize();
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testPhase = 0;
var testObs = {
observe: function(aSubject, aTopic, aData) {
var doc = aSubject.document;
var searchbox = doc.getElementById("search-box");
var clearButton = doc.getElementById("clearListButton");
@@ -185,19 +185,19 @@ function runTest()
break;
}
}
};
obs.addObserver(testObs, DLMGR_UI_DONE);
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_close_download_manager.xul
+++ b/suite/common/downloads/tests/chrome/test_close_download_manager.xul
@@ -54,18 +54,18 @@
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript">
<![CDATA[
-const dmui = Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsIDownloadManagerUI);
+const dmui = Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsIDownloadManagerUI);
function testCloseDMWithAccelKey(aWin)
{
function dmWindowClosedListener() {
aWin.removeEventListener("unload", dmWindowClosedListener, false);
ok(!dmui.visible, "DMUI closes with accel + w");
SimpleTest.finish();
}
@@ -79,18 +79,18 @@ function runTest()
const DLMGR_UI_DONE = "download-manager-ui-done";
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
var testPhase = 0;
// Specify an observer that will be notified when the dm has been rendered on screen
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
var testObs = {
observe: function(aSubject, aTopic, aData) {
SimpleTest.waitForFocus(function () { closeDM(aSubject) }, aSubject);
}
};
function closeDM(win) {
// if we add more ways to close DM with keys, add more cases here
@@ -98,19 +98,19 @@ function runTest()
case 0:
obs.removeObserver(testObs, DLMGR_UI_DONE);
testCloseDMWithAccelKey(win);
}
}
obs.addObserver(testObs, DLMGR_UI_DONE);
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_delete_key_cancels.xul
+++ b/suite/common/downloads/tests/chrome/test_delete_key_cancels.xul
@@ -73,103 +73,103 @@ dlObs.prototype = {
// We're done!
this.mWin.close();
SimpleTest.finish();
}
},
onDownloadStateChange: function(aState, aDownload)
{
- if (aDownload.state == Components.interfaces.nsIDownloadManager.DOWNLOAD_DOWNLOADING &&
+ if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING &&
!this.wasPaused) {
// Make a copy of the cancelDownload function and replace it with a test
var counter = () => invokeCount++;
[cancelDownload, this.mWin["cancelDownload"]] = [this.mWin["cancelDownload"], counter];
synthesizeKey("VK_DELETE", {}, this.mWin);
is(invokeCount, 1, "Delete canceled the active download");
this.wasPaused = true;
this.mWin.pauseDownload(aDownload.id);
}
- if (aDownload.state == Components.interfaces.nsIDownloadManager.DOWNLOAD_PAUSED &&
+ if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_PAUSED &&
!this.wasCanceled) {
synthesizeKey("VK_DELETE", {}, this.mWin);
is(invokeCount, 2, "Delete canceled the paused download");
// After all tests, restore original function
this.mWin["cancelDownload"] = cancelDownload;
this.wasCanceled = true;
this.mWin.cancelDownload(aDownload);
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
dm.removeListener(this);
// We have to do this on a timer so other JS stuff that handles the UI
// can actually catch up to us...
- var timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
- timer.init(this, 0, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ var timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
+ timer.init(this, 0, Ci.nsITimer.TYPE_ONE_SHOT);
}
},
onStateChange: function(a, b, c, d, e) { },
onProgressChange: function(a, b, c, d, e, f, g) { },
onSecurityChange: function(a, b, c, d) { }
};
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
function addDownload() {
function createURI(aObj) {
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- return (aObj instanceof Components.interfaces.nsIFile) ? ios.newFileURI(aObj) :
+ var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+ return (aObj instanceof Ci.nsIFile) ? ios.newFileURI(aObj) :
ios.newURI(aObj);
}
- const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
- var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
- .createInstance(nsIWBP);
+ const nsIWBP = Ci.nsIWebBrowserPersist;
+ var persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
+ .createInstance(nsIWBP);
persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
- var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties);
- var destFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
+ var dirSvc = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties);
+ var destFile = dirSvc.get("ProfD", Ci.nsIFile);
destFile.append("download.result");
if (destFile.exists())
destFile.remove(false);
- var dl = dm.addDownload(Components.interfaces.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
+ var dl = dm.addDownload(Ci.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
createURI("http://example.com/httpd.js"),
createURI(destFile), null, null,
Math.round(Date.now() * 1000), null, persist, false);
- persist.progressListener = dl.QueryInterface(Components.interfaces.nsIWebProgressListener);
+ persist.progressListener = dl.QueryInterface(Ci.nsIWebProgressListener);
persist.saveURI(dl.source, null, null, 0, null, null, dl.targetFile, null);
return dl;
}
// First, we clear out the database
dm.DBConnection.executeSimpleSQL("DELETE FROM moz_downloads");
// See if the DM is already open, and if it is, close it!
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win)
win.close();
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testObs = {
observe: function(aSubject, aTopic, aData)
{
if (aTopic != DLMGR_UI_DONE)
return;
@@ -186,19 +186,19 @@ function test()
doc.getElementById("downloadTree").view.selection.select(0);
os.removeObserver(testObs, DLMGR_UI_DONE);
}
// Register with the observer service
os.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_delete_key_removes.xul
+++ b/suite/common/downloads/tests/chrome/test_delete_key_removes.xul
@@ -52,76 +52,76 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript">
<![CDATA[
-var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
-var dmFile = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+var dmFile = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
dmFile.append("dm-ui-test.file");
-dmFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
+dmFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var gTestPath = ios.newFileURI(dmFile).spec;
// Downloads are sorted by endTime, so make sure the end times are distinct
const DownloadData = [
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859239,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED,
+ state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859236,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_FAILED,
+ state: Ci.nsIDownloadManager.DOWNLOAD_FAILED,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859234,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_CANCELED,
+ state: Ci.nsIDownloadManager.DOWNLOAD_CANCELED,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859232,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_BLOCKED_PARENTAL,
+ state: Ci.nsIDownloadManager.DOWNLOAD_BLOCKED_PARENTAL,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859230,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_DIRTY,
+ state: Ci.nsIDownloadManager.DOWNLOAD_DIRTY,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 },
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859229,
endTime: 1180493839859229,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_BLOCKED_POLICY,
+ state: Ci.nsIDownloadManager.DOWNLOAD_BLOCKED_POLICY,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 }
];
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// First, we populate the database with some fake data
db.executeSimpleSQL("DELETE FROM moz_downloads");
var stmt = db.createStatement(
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
"state, currBytes, maxBytes, preferredAction, autoResume) " +
"VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
@@ -134,18 +134,18 @@ function test()
}
stmt.finalize();
// See if the DM is already open, and if it is, close it!
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win)
win.close();
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testObs = {
observe: function(aSubject, aTopic, aData)
{
if (aTopic != DLMGR_UI_DONE)
return;
@@ -184,19 +184,19 @@ function test()
os.removeObserver(testObs, DLMGR_UI_DONE);
SimpleTest.finish();
}
// Register with the observer service
os.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_drag.xul
+++ b/suite/common/downloads/tests/chrome/test_drag.xul
@@ -66,46 +66,46 @@ close window
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
<script type="application/javascript">
<![CDATA[
var missingFileElid;
var realFileElid;
const kFiller = "notApplicable";
const kFillerURL = "https://bugzilla.mozilla.org/show_bug.cgi?id=462172"
-var realFile = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("CurWorkD", Components.interfaces.nsIFile);
-var missingFile = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("CurWorkD", Components.interfaces.nsIFile);
+var realFile = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("CurWorkD", Ci.nsIFile);
+var missingFile = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("CurWorkD", Ci.nsIFile);
-var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
realFile.append(kFiller);
-realFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
+realFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var realFilePath = ios.newFileURI(realFile).spec;
missingFile.append(kFiller);
-missingFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
+missingFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var missingFilePath = ios.newFileURI(missingFile).spec;
missingFile.remove(false);
// Dummy data for our files.
// 'source' field must be in form of a URL.
const DownloadData = [
{ name: kFiller,
source: kFillerURL,
target: realFilePath,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED },
+ state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED },
{ name: kFiller,
source: kFillerURL,
target: missingFilePath,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED }
+ state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED }
];
function mouseDragStartOnCell(aTree, aRow, aColumn, aWin, aFile)
{
// get cell coordinates
if (typeof aTree.columns != "undefined")
aColumn = aTree.columns[aColumn];
var rect = aTree.treeBoxObject.getCoordsForCellItem(aRow, aColumn, "text");
@@ -133,26 +133,26 @@ var dragMissingFile = [[
{ type: "text/uri-list",
data: missingFilePath + "\r\n" },
{ type: "text/plain",
data: missingFilePath + "\n" }
]];
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
// See if the DM is already open, and if it is, close it!
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win)
win.close();
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
// load files into db
var db = dm.DBConnection;
var stmt = db.createStatement(
"INSERT INTO moz_downloads ( name, source, target, state)" +
"VALUES (:name, :source, :target, :state)");
@@ -188,19 +188,19 @@ function test()
SimpleTest.finish();
}
};
// Register with the observer service
os.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_enter_dblclick_opens.xul
+++ b/suite/common/downloads/tests/chrome/test_enter_dblclick_opens.xul
@@ -114,90 +114,90 @@ dlObs.prototype = {
this.mWin.close();
this.currDownload.targetFile.remove(false);
SimpleTest.finish();
}
},
onDownloadStateChange: function(aState, aDownload)
{
- if (aDownload.state == Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED) {
+ if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_FINISHED) {
this.currDownload = aDownload;
// We have to do this on a timer so other JS stuff that handles the UI
// can actually catch up to us...
- var timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
- timer.init(this, 0, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ var timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
+ timer.init(this, 0, Ci.nsITimer.TYPE_ONE_SHOT);
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
dm.removeListener(this);
}
},
onStateChange: function(a, b, c, d, e) { },
onProgressChange: function(a, b, c, d, e, f, g) { },
onSecurityChange: function(a, b, c, d) { }
};
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
function addDownload() {
function createURI(aObj) {
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- return (aObj instanceof Components.interfaces.nsIFile) ? ios.newFileURI(aObj) :
+ var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+ return (aObj instanceof Ci.nsIFile) ? ios.newFileURI(aObj) :
ios.newURI(aObj);
}
- const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
- var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
- .createInstance(nsIWBP);
+ const nsIWBP = Ci.nsIWebBrowserPersist;
+ var persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
+ .createInstance(nsIWBP);
persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
- var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties);
- var destFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
+ var dirSvc = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties);
+ var destFile = dirSvc.get("ProfD", Ci.nsIFile);
destFile.append("download.result");
if (destFile.exists())
destFile.remove(false);
- var dl = dm.addDownload(Components.interfaces.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
+ var dl = dm.addDownload(Ci.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
createURI("http://example.com/httpd.js"),
createURI(destFile), null, null,
Math.round(Date.now() * 1000), null, persist, false);
- persist.progressListener = dl.QueryInterface(Components.interfaces.nsIWebProgressListener);
+ persist.progressListener = dl.QueryInterface(Ci.nsIWebProgressListener);
persist.saveURI(dl.source, null, null, 0, null, null, dl.targetFile, null);
return dl;
}
var db = dm.DBConnection;
// Empty any old downloads
db.executeSimpleSQL("DELETE FROM moz_downloads");
var stmt = db.createStatement(
"INSERT INTO moz_downloads (source, state, target, referrer) " +
"VALUES (?1, ?2, ?3, ?4)");
// add first download: PAUSED state
try {
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append("dltest-paused");
- var fileSpec = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService)
- .newFileURI(file).spec;
+ var fileSpec = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+ .newFileURI(file).spec;
stmt.bindByIndex(0, "http://example.com/file");
stmt.bindByIndex(1, dm.DOWNLOAD_PAUSED);
stmt.bindByIndex(2, fileSpec);
stmt.bindByIndex(3, "http://referrer/");
// Add it!
stmt.execute();
}
@@ -205,18 +205,18 @@ function test()
stmt.reset();
stmt.finalize();
}
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testObs = {
observe: function(aSubject, aTopic, aData) {
if (aTopic != DLMGR_UI_DONE)
return;
SimpleTest.waitForFocus(function () { continueTest(aSubject) }, aSubject);
@@ -231,19 +231,19 @@ function test()
addDownload();
obs.removeObserver(testObs, DLMGR_UI_DONE);
}
obs.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_multi_select.xul
+++ b/suite/common/downloads/tests/chrome/test_multi_select.xul
@@ -19,35 +19,35 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript">
<![CDATA[
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// Empty any old downloads
db.executeSimpleSQL("DELETE FROM moz_downloads");
var stmt = db.createStatement(
"INSERT INTO moz_downloads (source, state, target, referrer) " +
"VALUES (?1, ?2, ?3, ?4)");
try {
for (let site of ["ed.agadak.net", "mozilla.org", "mozilla.com", "mozilla.net"]) {
- let file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ let file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append(site);
- let fileSpec = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService)
+ let fileSpec = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
.newFileURI(file).spec;
stmt.bindByIndex(0, "http://" + site + "/file");
stmt.bindByIndex(1, dm.DOWNLOAD_FINISHED);
stmt.bindByIndex(2, fileSpec);
stmt.bindByIndex(3, "http://referrer/");
// Add it!
@@ -58,18 +58,18 @@ function test()
stmt.reset();
stmt.finalize();
}
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testPhase = 0;
var testObs = {
observe: function(aSubject, aTopic, aData) {
if (aTopic != DLMGR_UI_DONE)
return;
@@ -83,27 +83,27 @@ function test()
// Default test/check for invocations
var invokeCount = 0;
var counter = () => invokeCount++;
// Accessors for returning a value for various properties
var getItems = () => downloadView.rowCount;
var getSelected = () => downloadView.selection.count;
var getClipboard = function() {
- var clip = Components.classes["@mozilla.org/widget/clipboard;1"]
- .getService(Components.interfaces.nsIClipboard);
- var trans = Components.classes["@mozilla.org/widget/transferable;1"]
- .createInstance(Components.interfaces.nsITransferable);
+ var clip = Cc["@mozilla.org/widget/clipboard;1"]
+ .getService(Ci.nsIClipboard);
+ var trans = Cc["@mozilla.org/widget/transferable;1"]
+ .createInstance(Ci.nsITransferable);
trans.init(null);
trans.addDataFlavor("text/unicode");
clip.getData(trans, clip.kGlobalClipboard);
var str = {};
trans.getTransferData("text/unicode", str, {});
- return str.value.QueryInterface(Components.interfaces.nsISupportsString)
+ return str.value.QueryInterface(Ci.nsISupportsString)
.data;
};
// Array of tests that consist of the command name, download manager
// function to temporarily replace, method to use in its place, value to
// use when checking correctness
var commandTests = [
["pause", "pauseDownload", counter, counter],
@@ -188,19 +188,19 @@ function test()
// We're done!
win.close();
obs.removeObserver(testObs, DLMGR_UI_DONE);
SimpleTest.finish();
}
obs.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_multiword_search.xul
+++ b/suite/common/downloads/tests/chrome/test_multiword_search.xul
@@ -52,31 +52,31 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript">
<![CDATA[
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// Empty any old downloads
db.executeSimpleSQL("DELETE FROM moz_downloads");
// Make a file name for the downloads
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append("multiWord");
- var filePath = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService)
- .newFileURI(file).spec;
+ var filePath = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+ .newFileURI(file).spec;
var stmt = db.createStatement(
"INSERT INTO moz_downloads (name, target, source, state, endTime, maxBytes) " +
"VALUES (?1, ?2, ?3, ?4, ?5, ?6)");
try {
for (let site of ["ed.agadak.net", "mozilla.org"]) {
stmt.bindByIndex(0, "Super Pimped Download");
@@ -93,18 +93,18 @@ function test()
stmt.reset();
stmt.finalize();
}
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testPhase = -1;
var testObs = {
observe: function(aSubject, aTopic, aData) {
if (aTopic != DLMGR_UI_DONE)
return;
@@ -156,19 +156,19 @@ function test()
break;
}
}
};
obs.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_open_properties.xul
+++ b/suite/common/downloads/tests/chrome/test_open_properties.xul
@@ -53,24 +53,24 @@
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript">
<![CDATA[
-const nsIDownloadManager = Components.interfaces.nsIDownloadManager;
-var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
-var dmFile = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+const nsIDownloadManager = Ci.nsIDownloadManager;
+var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+var dmFile = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
dmFile.append("dm-ui-test.file");
-dmFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
+dmFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var gTestPath = ios.newFileURI(dmFile).spec;
const DoneDownloadData = [
{ name: "Dead",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859239,
@@ -85,18 +85,18 @@ const ActiveDownloadData = [
startTime: 1180493839859230,
endTime: 1180493839859239,
state: nsIDownloadManager.DOWNLOAD_DOWNLOADING,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 }
];
function runTest()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// Empty any old downloads
db.executeSimpleSQL("DELETE FROM moz_downloads");
var stmt = db.createStatement(
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
"state, currBytes, maxBytes, preferredAction, autoResume) " +
@@ -109,18 +109,18 @@ function runTest()
stmt.execute();
}
//stmt.finalize();
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var dmview;
var testStartTime = Date.now();
var testPhase = 0;
var testObs = {
observe: function(aSubject, aTopic, aData) {
switch (testPhase++) {
@@ -181,19 +181,19 @@ function runTest()
break;
}
}
};
obs.addObserver(testObs, DLMGR_UI_DONE);
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_removeDownload_updates_ui.xul
+++ b/suite/common/downloads/tests/chrome/test_removeDownload_updates_ui.xul
@@ -49,39 +49,39 @@
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript">
<![CDATA[
-var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
-var dmFile = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+var dmFile = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
dmFile.append("dm-ui-test.file");
-dmFile.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666);
+dmFile.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
var gTestPath = ios.newFileURI(dmFile).spec;
const DownloadData = [
{ name: "381603.patch",
source: "https://bugzilla.mozilla.org/attachment.cgi?id=266520",
target: gTestPath,
startTime: 1180493839859230,
endTime: 1180493839859239,
- state: Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED,
+ state: Ci.nsIDownloadManager.DOWNLOAD_FINISHED,
currBytes: 0, maxBytes: -1, preferredAction: 0, autoResume: 0 }
];
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// First, we populate the database with some fake data
db.executeSimpleSQL("DELETE FROM moz_downloads");
var stmt = db.createStatement(
"INSERT INTO moz_downloads (name, source, target, startTime, endTime, " +
"state, currBytes, maxBytes, preferredAction, autoResume) " +
"VALUES (:name, :source, :target, :startTime, :endTime, :state, " +
@@ -94,18 +94,18 @@ function test()
}
stmt.finalize();
// See if the DM is already open, and if it is, close it!
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win)
win.close();
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testObs = {
observe: function(aSubject, aTopic, aData)
{
if (aTopic != DLMGR_UI_DONE)
return;
@@ -135,19 +135,19 @@ function test()
SimpleTest.finish();
}
}
// Register with the observer service
os.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_search_clearlist.xul
+++ b/suite/common/downloads/tests/chrome/test_search_clearlist.xul
@@ -51,31 +51,31 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript">
<![CDATA[
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// Empty any old downloads
db.executeSimpleSQL("DELETE FROM moz_downloads");
// Make a file name for the downloads
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append("cleanUp");
- var filePath = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService)
- .newFileURI(file).spec;
+ var filePath = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+ .newFileURI(file).spec;
var stmt = db.createStatement(
"INSERT INTO moz_downloads (target, source, state, endTime) " +
"VALUES (?1, ?2, ?3, ?4)");
// Add a bunch of downloads that don't match the search
var sites = [];
for (let i = 0; i < 50; i++)
@@ -101,18 +101,18 @@ function test()
stmt.reset();
stmt.finalize();
}
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testPhase = 0;
var testObs = {
observe: function(aSubject, aTopic, aData) {
if (aTopic != DLMGR_UI_DONE)
return;
@@ -151,19 +151,19 @@ function test()
break;
}
}
};
obs.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_search_keys.xul
+++ b/suite/common/downloads/tests/chrome/test_search_keys.xul
@@ -74,26 +74,26 @@ function test_meta_f(aWin)
}
var testFuncs = [
test_meta_f,
]
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
// See if the DM is already open, and if it is, close it!
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win)
win.close();
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testObs = {
observe: function(aSubject, aTopic, aData)
{
if (aTopic != DLMGR_UI_DONE)
return;
@@ -110,19 +110,19 @@ function test()
os.removeObserver(testObs, DLMGR_UI_DONE);
SimpleTest.finish();
}
// Register with the observer service
os.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_select_all.xul
+++ b/suite/common/downloads/tests/chrome/test_select_all.xul
@@ -53,31 +53,31 @@
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript">
<![CDATA[
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
var db = dm.DBConnection;
// Empty any old downloads
db.executeSimpleSQL("DELETE FROM moz_downloads");
// Make a file name for the downloads
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append("selectAll");
- var filePath = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService)
- .newFileURI(file).spec;
+ var filePath = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService)
+ .newFileURI(file).spec;
var stmt = db.createStatement(
"INSERT INTO moz_downloads (target, source, state) " +
"VALUES (?1, ?2, ?3)");
var sites = ["mozilla.org", "mozilla.com", "select.all"];
try {
for (let site of sites) {
@@ -93,18 +93,18 @@ function test()
stmt.reset();
stmt.finalize();
}
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testObs = {
observe: function(aSubject, aTopic, aData) {
if (aTopic != DLMGR_UI_DONE)
return;
SimpleTest.waitForFocus(function () { continueTest(aSubject) }, aSubject);
@@ -129,19 +129,19 @@ function test()
win.close();
obs.removeObserver(testObs, DLMGR_UI_DONE);
SimpleTest.finish();
}
obs.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_space_key_pauses_resumes.xul
+++ b/suite/common/downloads/tests/chrome/test_space_key_pauses_resumes.xul
@@ -65,18 +65,18 @@ function bug413985obs(aWin)
this.wasFinished = false;
}
bug413985obs.prototype = {
observe: function(aSubject, aTopic, aData)
{
if ("timer-callback" == aTopic) {
if (this.wasFinished) {
// We're done!
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
dm.removeListener(this);
this.mWin.close();
SimpleTest.finish();
} else {
if (!this.wasPaused)
this.wasPaused = true;
else if (!this.wasResumed)
this.wasResumed = true;
@@ -86,111 +86,111 @@ bug413985obs.prototype = {
}
}
},
onDownloadStateChange: function(aState, aDownload)
{
ok(true, "State value = " + aDownload.state);
switch (aDownload.state) {
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_DOWNLOADING:
+ case Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING:
if (!this.wasPaused) {
ok(true, "The download was started successfully");
// We have to do this on a timer so other JS stuff that handles the UI
// can actually catch up to us...
- var timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
- timer.init(this, 0, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ var timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
+ timer.init(this, 0, Ci.nsITimer.TYPE_ONE_SHOT);
} else {
ok(this.wasResumed, "The download was resumed successfully");
}
break;
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_PAUSED:
+ case Ci.nsIDownloadManager.DOWNLOAD_PAUSED:
ok(this.wasPaused && !this.wasResumed,
"The download was paused successfully");
if (!this.wasResumed) {
// We have to do this on a timer so other JS stuff that handles the UI
// can actually catch up to us...
- var timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
- timer.init(this, 0, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ var timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
+ timer.init(this, 0, Ci.nsITimer.TYPE_ONE_SHOT);
}
break;
- case Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED:
+ case Ci.nsIDownloadManager.DOWNLOAD_FINISHED:
ok(this.wasPaused && this.wasResumed,
"The download was paused, and then resumed to completion");
this.wasFinished = true;
aDownload.targetFile.remove(false);
// We have to do this on a timer so other JS stuff that handles the UI
// can actually catch up to us...
- var timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
- timer.init(this, 0, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ var timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
+ timer.init(this, 0, Ci.nsITimer.TYPE_ONE_SHOT);
break;
default:
break;
}
},
onStateChange: function(a, b, c, d, e) { },
onProgressChange: function(a, b, c, d, e, f, g) { },
onSecurityChange: function(a, b, c, d) { }
};
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
function addDownload() {
function createURI(aObj) {
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- return (aObj instanceof Components.interfaces.nsIFile) ? ios.newFileURI(aObj) :
+ var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+ return (aObj instanceof Ci.nsIFile) ? ios.newFileURI(aObj) :
ios.newURI(aObj);
}
- const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
- var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
- .createInstance(nsIWBP);
+ const nsIWBP = Ci.nsIWebBrowserPersist;
+ var persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
+ .createInstance(nsIWBP);
persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
- var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties);
- var destFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
+ var dirSvc = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties);
+ var destFile = dirSvc.get("ProfD", Ci.nsIFile);
destFile.append("download.result");
if (destFile.exists())
destFile.remove(false);
// SeaMonkey: Use a bigger file than "http://example.com/httpd.js". (Bug 595685)
- var dl = dm.addDownload(Components.interfaces.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
+ var dl = dm.addDownload(Ci.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
createURI("http://example.com/tests/fonts/mplus/mplus-1p-regular.ttf"),
createURI(destFile), null, null,
Math.round(Date.now() * 1000), null, persist, false);
- persist.progressListener = dl.QueryInterface(Components.interfaces.nsIWebProgressListener);
+ persist.progressListener = dl.QueryInterface(Ci.nsIWebProgressListener);
persist.saveURI(dl.source, null, null, 0, null, null, dl.targetFile, null);
return dl;
}
// First, we clear out the database
dm.DBConnection.executeSimpleSQL("DELETE FROM moz_downloads");
// See if the DM is already open, and if it is, close it!
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win)
win.close();
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testObs = {
observe: function(aSubject, aTopic, aData)
{
if (aTopic != DLMGR_UI_DONE)
return;
@@ -207,19 +207,19 @@ function test()
doc.getElementById("downloadTree").view.selection.select(0);
os.removeObserver(testObs, DLMGR_UI_DONE);
}
// Register with the observer service
os.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_space_key_retries.xul
+++ b/suite/common/downloads/tests/chrome/test_space_key_retries.xul
@@ -75,99 +75,99 @@ dlObs.prototype = {
// dispatch a space keypress to retry the download
synthesizeKey(" ", {}, this.mWin);
}
}
},
onDownloadStateChange: function(aState, aDownload)
{
- if (aDownload.state == Components.interfaces.nsIDownloadManager.DOWNLOAD_DOWNLOADING &&
+ if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING &&
!this.wasCanceled) {
this.wasCanceled = true;
this.mWin.cancelDownload(aDownload);
}
- if (aDownload.state == Components.interfaces.nsIDownloadManager.DOWNLOAD_CANCELED) {
+ if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_CANCELED) {
// We have to do this on a timer so other JS stuff that handles the UI
// can actually catch up to us...
- var timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
- timer.init(this, 0, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ var timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
+ timer.init(this, 0, Ci.nsITimer.TYPE_ONE_SHOT);
}
- if (aDownload.state == Components.interfaces.nsIDownloadManager.DOWNLOAD_FINISHED) {
+ if (aDownload.state == Ci.nsIDownloadManager.DOWNLOAD_FINISHED) {
ok(this.wasCanceled,
"The download was canceled, retried and then ran to completion");
this.wasFinished = true;
aDownload.targetFile.remove(false);
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
dm.removeListener(this);
// We have to do this on a timer so other JS stuff that handles the UI
// can actually catch up to us...
- var timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
- timer.init(this, 0, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ var timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
+ timer.init(this, 0, Ci.nsITimer.TYPE_ONE_SHOT);
}
},
onStateChange: function(a, b, c, d, e) { },
onProgressChange: function(a, b, c, d, e, f, g) { },
onSecurityChange: function(a, b, c, d) { }
};
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
function addDownload() {
function createURI(aObj) {
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- return (aObj instanceof Components.interfaces.nsIFile) ? ios.newFileURI(aObj) :
+ var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
+ return (aObj instanceof Ci.nsIFile) ? ios.newFileURI(aObj) :
ios.newURI(aObj);
}
- const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
- var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
- .createInstance(nsIWBP);
+ const nsIWBP = Ci.nsIWebBrowserPersist;
+ var persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
+ .createInstance(nsIWBP);
persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
- var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties);
- var destFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
+ var dirSvc = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties);
+ var destFile = dirSvc.get("ProfD", Ci.nsIFile);
destFile.append("download.result");
if (destFile.exists())
destFile.remove(false);
- var dl = dm.addDownload(Components.interfaces.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
+ var dl = dm.addDownload(Ci.nsIDownloadManager.DOWNLOAD_TYPE_DOWNLOAD,
createURI("http://example.com/httpd.js"),
createURI(destFile), null, null,
Math.round(Date.now() * 1000), null, persist, false);
- persist.progressListener = dl.QueryInterface(Components.interfaces.nsIWebProgressListener);
+ persist.progressListener = dl.QueryInterface(Ci.nsIWebProgressListener);
persist.saveURI(dl.source, null, null, 0, null, null, dl.targetFile, null);
return dl;
}
// First, we clear out the database
dm.DBConnection.executeSimpleSQL("DELETE FROM moz_downloads");
// See if the DM is already open, and if it is, close it!
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win)
win.close();
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testObs = {
observe: function(aSubject, aTopic, aData)
{
if (aTopic != DLMGR_UI_DONE)
return;
@@ -184,19 +184,19 @@ function test()
doc.getElementById("downloadTree").view.selection.select(0);
os.removeObserver(testObs, DLMGR_UI_DONE);
}
// Register with the observer service
os.addObserver(testObs, DLMGR_UI_DONE);
// Show the Download Manager UI
- Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsISuiteDownloadManagerUI)
- .showManager();
+ Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsISuiteDownloadManagerUI)
+ .showManager();
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
--- a/suite/common/downloads/tests/chrome/test_ui_stays_open_on_alert_clickback.xul
+++ b/suite/common/downloads/tests/chrome/test_ui_stays_open_on_alert_clickback.xul
@@ -53,61 +53,61 @@
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript">
<![CDATA[
ChromeUtils.import("resource://gre/modules/Services.jsm");
function test()
{
- var dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
// Empty any old downloads
dm.DBConnection.executeSimpleSQL("DELETE FROM moz_downloads");
var setClose = aVal =>
Services.prefs.setBoolPref("browser.download.manager.closeWhenDone", aVal);
// Close the UI if necessary
var win = Services.wm.getMostRecentWindow("Download:Manager");
if (win) win.close();
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
const DLMGR_UI_DONE = "download-manager-ui-done";
var testObs = {
observe: function(aSubject, aTopic, aData)
{
if (aTopic != DLMGR_UI_DONE)
return;
var win = aSubject;
// Note: This test will not be valid if the download list is built
// synchronously in Startup in downloads.js
// Make sure the window stays open
- var dmui = Components.classes["@mozilla.org/download-manager-ui;1"]
- .getService(Components.interfaces.nsIDownloadManagerUI);
+ var dmui = Cc["@mozilla.org/download-manager-ui;1"]
+ .getService(Ci.nsIDownloadManagerUI);
ok(dmui.visible, "Download Manager stays open on alert click");
win.close();
setClose(false);
os.removeObserver(testObs, DLMGR_UI_DONE);
SimpleTest.finish();
}
};
// Register with the observer service
os.addObserver(testObs, DLMGR_UI_DONE);
// Simulate an alert click with pref set to true
setClose(true);
- dm.QueryInterface(Components.interfaces.nsIObserver)
+ dm.QueryInterface(Ci.nsIObserver)
.observe(null, "alertclickcallback", null);
SimpleTest.waitForExplicitFinish();
}
]]>
</script>
--- a/suite/common/downloads/treeView.js
+++ b/suite/common/downloads/treeView.js
@@ -1,16 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
-const nsITreeView = Components.interfaces.nsITreeView;
+const nsITreeView = Ci.nsITreeView;
// const nsIDownloadManager is already defined in downloadmanager.js
function DownloadTreeView() {
this._dlList = [];
this._searchTerms = [];
}
DownloadTreeView.prototype = {
--- a/suite/common/downloads/uploadProgress.js
+++ b/suite/common/downloads/uploadProgress.js
@@ -3,20 +3,20 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
const kInterval = 750; // Default to .75 seconds.
-var gPersist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
- .createInstance(Components.interfaces.nsIWebBrowserPersist);
-var gSource = window.arguments[0].QueryInterface(Components.interfaces.nsIFileURL);
-var gTarget = window.arguments[1].QueryInterface(Components.interfaces.nsIURL);
+var gPersist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
+ .createInstance(Ci.nsIWebBrowserPersist);
+var gSource = window.arguments[0].QueryInterface(Ci.nsIFileURL);
+var gTarget = window.arguments[1].QueryInterface(Ci.nsIURL);
var gFileName = gSource.file.leafName;
var gFileSize = gSource.file.fileSize;
var gPercent = -1;
var gStartTime;
var gLastUpdate;
var gLastSeconds;
var gBundle;
var gStatus;
@@ -47,17 +47,17 @@ function onLoad()
gPersist.progressListener = gProgressListener;
gPersist.saveURI(gSource, null, null, 0, null, null, gTarget, null);
document.documentElement.getButton("cancel").focus();
}
function onUnload()
{
if (gPersist)
- gPersist.cancel(Components.results.NS_BINDING_ABORTED);
+ gPersist.cancel(Cr.NS_BINDING_ABORTED);
gPersist = null;
}
function setPercent(aPercent, aStatus)
{
gPercent = aPercent;
document.title = gBundle.getFormattedString("progressTitlePercent",
[aPercent, gFileName, aStatus]);
@@ -66,19 +66,19 @@ function setPercent(aPercent, aStatus)
gMeter.value = aPercent;
}
var gProgressListener = {
// ----- nsIWebProgressListener methods -----
// Look for STATE_STOP and close dialog to indicate completion when it happens.
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
- if (aRequest instanceof Components.interfaces.nsIChannel &&
+ if (aRequest instanceof Ci.nsIChannel &&
aRequest.URI.equals(gTarget) &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) {
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) {
gPersist = null;
var status = gBundle.getString("finished");
setPercent(100, status);
gStatus.value = status;
gSize.value = DownloadUtils.getTransferTotal(gFileSize, gFileSize);
setTimeout(window.close, kInterval);
}
},
@@ -90,17 +90,17 @@ var gProgressListener = {
return this.onProgressChange64(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress);
},
onProgressChange64: function(aWebProgress, aRequest,
aCurSelfProgress, aMaxSelfProgress,
aCurTotalProgress, aMaxTotalProgress) {
- if (aRequest instanceof Components.interfaces.nsIChannel &&
+ if (aRequest instanceof Ci.nsIChannel &&
aRequest.URI.equals(gTarget)) {
// Get current time.
var now = Date.now();
// If interval hasn't elapsed, ignore it.
if (!gStartTime)
gStartTime = now;
else if (now - gLastUpdate < kInterval && aCurTotalProgress < gFileSize)
@@ -144,17 +144,17 @@ var gProgressListener = {
DownloadUtils.convertByteUnits(rate))]);
gSize.value = size;
}
},
// Look for error notifications and display alert to user.
onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage) {
// Check for error condition (only if dialog is still open).
- if (!Components.results.isSuccessCode(aStatus)) {
+ if (!Cr.isSuccessCode(aStatus)) {
// Display error alert (using text supplied by back-end).
Services.prompt.alert(window, document.title, aMessage);
// Close the dialog.
window.close();
}
},
// Ignore onLocationChange and onSecurityChange notifications.
@@ -162,28 +162,28 @@ var gProgressListener = {
},
onSecurityChange: function( aWebProgress, aRequest, aState ) {
},
// ---------- nsISupports methods ----------
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsIWebProgressListener2,
- Components.interfaces.nsIWebProgressListener,
- Components.interfaces.nsIInterfaceRequestor]),
+ Ci.nsIWebProgressListener2,
+ Ci.nsIWebProgressListener,
+ Ci.nsIInterfaceRequestor]),
// ---------- nsIInterfaceRequestor methods ----------
getInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIPrompt) ||
- aIID.equals(Components.interfaces.nsIAuthPrompt)) {
+ if (aIID.equals(Ci.nsIPrompt) ||
+ aIID.equals(Ci.nsIAuthPrompt)) {
var prompt;
- if (aIID.equals(Components.interfaces.nsIPrompt))
+ if (aIID.equals(Ci.nsIPrompt))
prompt = Services.ww.getNewPrompter(window);
else
prompt = Services.ww.getNewAuthPrompter(window);
return prompt;
}
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
}
--- a/suite/common/findUtils.js
+++ b/suite/common/findUtils.js
@@ -26,17 +26,17 @@ nsFindInstData.prototype =
},
set currentSearchWindow(val) { this._current = val; },
get webBrowserFind() { return this.browser.webBrowserFind; },
init : function() {
var findInst = this.webBrowserFind;
// set up the find to search the focussedWindow, bounded by the content window.
- var findInFrames = findInst.QueryInterface(Components.interfaces.nsIWebBrowserFindInFrames);
+ var findInFrames = findInst.QueryInterface(Ci.nsIWebBrowserFindInFrames);
findInFrames.rootSearchFrame = this.rootSearchWindow;
findInFrames.currentSearchFrame = this.currentSearchWindow;
// always search in frames for now. We could add a checkbox to the dialog for this.
findInst.searchFrames = true;
},
window : window,
@@ -62,30 +62,30 @@ function findInPage(findInstData)
}
function findAgainInPage(findInstData, reverse)
{
var findbar = document.getElementById("FindToolbar");
if (findbar && Services.prefs.getBoolPref("browser.findbar.enabled"))
{
// first, look to see whether XPFE typeaheadfind wants to find next
- var sip = Components.classes["@mozilla.org/supports-interface-pointer;1"]
- .createInstance(Components.interfaces.nsISupportsInterfacePointer);
+ var sip = Cc["@mozilla.org/supports-interface-pointer;1"]
+ .createInstance(Ci.nsISupportsInterfacePointer);
sip.data = content;
Services.obs.notifyObservers(sip, "nsWebBrowserFind_FindAgain", reverse ? "up" : "down");
if (sip.data) // XPFE typeahead find was not interested in this find next
findbar.onFindAgainCommand(reverse);
}
else
{
// get the find service, which stores global find state, and init the
// nsIWebBrowser find with it. We don't assume that there was a previous
// Find that set this up.
- var findService = Components.classes["@mozilla.org/find/find_service;1"]
- .getService(Components.interfaces.nsIFindService);
+ var findService = Cc["@mozilla.org/find/find_service;1"]
+ .getService(Ci.nsIFindService);
var searchString = findService.searchString;
if (searchString.length == 0) {
// no previous find text
findInPage(findInstData);
return;
}
@@ -112,18 +112,18 @@ function findAgainInPage(findInstData, r
function canFindAgainInPage()
{
var findbar = document.getElementById("FindToolbar");
if (findbar && Services.prefs.getBoolPref("browser.findbar.enabled"))
// The findbar will just be brought up in an error state if you cannot find text again.
return true;
- var findService = Components.classes["@mozilla.org/find/find_service;1"]
- .getService(Components.interfaces.nsIFindService);
+ var findService = Cc["@mozilla.org/find/find_service;1"]
+ .getService(Ci.nsIFindService);
return (findService.searchString.length > 0);
}
function findLinksAsYouType()
{
var findbar = document.getElementById("FindToolbar");
if (findbar && Services.prefs.getBoolPref("accessibility.typeaheadfind.usefindbar"))
findbar.startFastFind(findbar.FIND_LINKS);
--- a/suite/common/helpviewer/contextHelp.js
+++ b/suite/common/helpviewer/contextHelp.js
@@ -21,18 +21,18 @@ function openHelp(topic, contentPack)
var topWindow = locateHelpWindow(helpFileURI);
if ( topWindow ) {
# Open topic in existing window.
topWindow.focus();
topWindow.displayTopic(topic);
} else {
# Open topic in new window.
- const params = Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
- .createInstance(Components.interfaces.nsIDialogParamBlock);
+ const params = Cc["@mozilla.org/embedcomp/dialogparam;1"]
+ .createInstance(Ci.nsIDialogParamBlock);
params.SetNumberStrings(2);
params.SetString(0, helpFileURI);
params.SetString(1, topic);
#ifdef XP_WIN
#define HELP_ALWAYS_RAISED_TOGGLE
#endif
#ifdef HELP_ALWAYS_RAISED_TOGGLE
Services.ww.openWindow(null, "chrome://help/content/help.xul", "_blank",
--- a/suite/common/history/controller.js
+++ b/suite/common/history/controller.js
@@ -116,22 +116,22 @@ PlacesController.prototype = {
case "placesCmd_open:window":
PlacesUIUtils.openSelectionIn(this._view.getSelectionNodes(), "window");
break;
case "placesCmd_open:tab":
PlacesUIUtils.openSelectionIn(this._view.getSelectionNodes(), "tab");
break;
case "placesCmd_delete:hostname":
PlacesUtils.history
- .QueryInterface(Components.interfaces.nsIBrowserHistory)
+ .QueryInterface(Ci.nsIBrowserHistory)
.removePagesFromHost(gLastHostname, false);
break;
case "placesCmd_delete:domain":
PlacesUtils.history
- .QueryInterface(Components.interfaces.nsIBrowserHistory)
+ .QueryInterface(Ci.nsIBrowserHistory)
.removePagesFromHost(gLastDomain, true);
break;
}
},
onEvent: function PC_onEvent(eventName) { },
/**
@@ -158,23 +158,23 @@ PlacesController.prototype = {
nodes.push(root); // See the second note above
for (var i = 0; i < nodes.length; i++) {
var nodeData = {};
var node = nodes[i];
var nodeType = node.type;
var uri = null;
- if (node.type == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_URI)
+ if (node.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_URI)
nodeData["link"] = true;
else {
nodeData["query"] = true;
if (node.parent) {
if (PlacesUtils.asQuery(node.parent).queryOptions.resultType ==
- Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY)
+ Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY)
nodeData["host"] = true;
else
nodeData["day"] = true;
}
}
metadata.push(nodeData);
}
@@ -298,30 +298,30 @@ PlacesController.prototype = {
/**
* Gives the user a chance to cancel loading lots of tabs at once
*/
_confirmOpenTabs: function(numTabsToOpen) {
const kWarnOnOpenPref = "browser.tabs.warnOnOpen";
var reallyOpen = true;
if (Services.prefs.getBoolPref(kWarnOnOpenPref)) {
if (numTabsToOpen >= Services.prefs.getIntPref("browser.tabs.maxOpenBeforeWarn")) {
- var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
+ var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Ci.nsIPromptService);
// default to true: if it were false, we wouldn't get this far
var warnOnOpen = { value: true };
var messageKey = "tabs.openWarningMultipleBranded";
var openKey = "tabs.openButtonMultiple";
var strings = document.getElementById("placeBundle");
const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties";
- var brandShortName = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle(BRANDING_BUNDLE_URI)
- .GetStringFromName("brandShortName");
+ var brandShortName = Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle(BRANDING_BUNDLE_URI)
+ .GetStringFromName("brandShortName");
var buttonPressed = promptService.confirmEx(window,
PlacesUIUtils.getString("tabs.openWarningTitle"),
PlacesUIUtils.getFormattedString(messageKey,
[numTabsToOpen, brandShortName]),
(promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0)
+ (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
PlacesUIUtils.getString(openKey),
@@ -378,17 +378,17 @@ PlacesController.prototype = {
/**
* Removes the set of selected ranges from history.
*/
_removeRowsFromHistory: function PC__removeRowsFromHistory() {
// Other containers are history queries, just delete from history
// history deletes are not undoable.
var nodes = this._view.getSelectionNodes();
var URIs = [];
- var bhist = PlacesUtils.history.QueryInterface(Components.interfaces.nsIBrowserHistory);
+ var bhist = PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory);
var root = this._view.getResultNode();
for (var i = 0; i < nodes.length; ++i) {
var node = nodes[i];
if (PlacesUtils.nodeIsHost(node))
bhist.removePagesFromHost(node.title, true);
else if (PlacesUtils.nodeIsURI(node)) {
var uri = PlacesUtils._uri(node.uri);
@@ -495,18 +495,18 @@ PlacesController.prototype = {
var didSuppressNotifications = result.suppressNotifications;
if (!didSuppressNotifications)
result.suppressNotifications = true;
try {
let nodes = this._view.getSelectionNodes();
- let xferable = Components.classes["@mozilla.org/widget/transferable;1"]
- .createInstance(Components.interfaces.nsITransferable);
+ let xferable = Cc["@mozilla.org/widget/transferable;1"]
+ .createInstance(Ci.nsITransferable);
xferable.init(null);
let foundFolder = false, foundLink = false;
let copiedFolders = [];
let placeString, mozURLString, htmlString, unicodeString;
placeString = mozURLString = htmlString = unicodeString = "";
for (let i = 0; i < nodes.length; ++i) {
let node = nodes[i];
--- a/suite/common/history/history.js
+++ b/suite/common/history/history.js
@@ -157,17 +157,17 @@ function historyAddBookmarks()
}
}
function searchHistory(aInput)
{
var query = PlacesUtils.history.getNewQuery();
var options = PlacesUtils.history.getNewQueryOptions();
- const NHQO = Components.interfaces.nsINavHistoryQueryOptions;
+ const NHQO = Ci.nsINavHistoryQueryOptions;
options.sortingMode = gHistoryTree.sortingMode;
options.queryType = NHQO.QUERY_TYPE_HISTORY;
if (aInput) {
query.searchTerms = aInput;
options.resultType = NHQO.RESULTS_AS_URI;
}
else {
--- a/suite/common/history/tree.xml
+++ b/suite/common/history/tree.xml
@@ -31,18 +31,18 @@
readonly="true"
onget="return this._controller;"/>
<!-- overriding -->
<property name="view">
<getter><![CDATA[
try {
return this.treeBoxObject.view
- .QueryInterface(Components.interfaces.nsITreeView)
- .QueryInterface(Components.interfaces.nsINavHistoryResultTreeViewer);
+ .QueryInterface(Ci.nsITreeView)
+ .QueryInterface(Ci.nsINavHistoryResultTreeViewer);
}
catch(e) {
return null;
}
]]></getter>
<setter><![CDATA[
return this.treeBoxObject.view = val;
]]></setter>
@@ -51,17 +51,17 @@
<property name="sortingMode" readonly="true">
<getter><![CDATA[
var result = this.getResult();
if (result)
// If we have a result then simply return its sorting mode.
return result.sortingMode;
else {
// Find the sorted column from the persisted attributes.
- const NHQO = Components.interfaces.nsINavHistoryQueryOptions;
+ const NHQO = Ci.nsINavHistoryQueryOptions;
var sortedColumn = this.columns.getSortedColumn();
if (!sortedColumn)
return NHQO.SORT_BY_NONE;
var sortDescending =
sortedColumn.element.getAttribute("sortDirection") != "ascending";
switch (sortedColumn.id) {
case "Name":
@@ -112,17 +112,17 @@
}
]]></body>
</method>
<!-- nsIPlacesView -->
<method name="getResult">
<body><![CDATA[
try {
- return this.view.QueryInterface(Components.interfaces.nsINavHistoryResultObserver).result;
+ return this.view.QueryInterface(Ci.nsINavHistoryResultObserver).result;
}
catch (e) {
return null;
}
]]></body>
</method>
<!-- nsIPlacesView -->
--- a/suite/common/history/treeView.js
+++ b/suite/common/history/treeView.js
@@ -37,24 +37,24 @@ function PlacesTreeView() {
this._rootNode = null;
this._rows = [];
this._nodeDetails = new Map();
}
PlacesTreeView.prototype = {
QueryInterface: function PTV_QueryInterface(aIID) {
- if (aIID.equals(Components.interfaces.nsITreeView) ||
- aIID.equals(Components.interfaces.nsINavHistoryResultObserver) ||
- aIID.equals(Components.interfaces.nsINavHistoryResultTreeViewer) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsITreeView) ||
+ aIID.equals(Ci.nsINavHistoryResultObserver) ||
+ aIID.equals(Ci.nsINavHistoryResultTreeViewer) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
/**
* This is called once both the result and the tree are set.
*/
_finishInit: function PTV__finishInit() {
var selection = this.selection;
if (selection)
@@ -90,22 +90,22 @@ PlacesTreeView.prototype = {
*
* @param aContainer
* A container result node.
*
* @return true if aContainer is a plain container, false otherwise.
*/
_isPlainContainer: function PTV__isPlainContainer(aContainer) {
// All history containers are query containers, but we need to QI
- aContainer.QueryInterface(Components.interfaces.nsINavHistoryQueryResultNode);
+ aContainer.QueryInterface(Ci.nsINavHistoryQueryResultNode);
// Of all history containers, only URI containers are flat, and they don't
// contain folders, no need to check that either.
return aContainer.queryOptions.resultType ==
- Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_URI;
+ Ci.nsINavHistoryQueryOptions.RESULTS_AS_URI;
},
/**
* Gets the row number for a given node. Assumes that the given node is
* visible (i.e. it's not an obsolete node).
*
* @param aNode
* A result node. Do not pass an obsolete node, or any
@@ -231,17 +231,17 @@ PlacesTreeView.prototype = {
let newNode = this._rootNode.getChild(aRow);
this._nodeDetails.delete(makeNodeDetailsKey(this._rows[aRow]));
this._nodeDetails.set(makeNodeDetailsKey(newNode), newNode);
return this._rows[aRow] = newNode;
}
// Unset elements may exist only in plain containers. Thus, if the nearest
// node is a container, it's the row's parent, otherwise, it's a sibling.
- if (rowNode instanceof Components.interfaces.nsINavHistoryContainerResultNode) {
+ if (rowNode instanceof Ci.nsINavHistoryContainerResultNode) {
let newNode = rowNode.getChild(aRow - row - 1);
this._nodeDetails.delete(makeNodeDetailsKey(this._rows[aRow]));
this._nodeDetails.set(makeNodeDetailsKey(newNode), newNode);
return this._rows[aRow] = newNode;
}
let [parent, parentRow] = this._getParentByChildRow(row);
let newNode = parent.getChild(aRow - parentRow - 1);
@@ -299,17 +299,17 @@ PlacesTreeView.prototype = {
var row = aFirstChildRow + rowsInserted;
this._nodeDetails.delete(makeNodeDetailsKey(this._rows[row]));
this._nodeDetails.set(makeNodeDetailsKey(curChild), curChild);
this._rows[row] = curChild;
rowsInserted++;
// recursively do containers
- if (curChild instanceof Components.interfaces.nsINavHistoryContainerResultNode) {
+ if (curChild instanceof Ci.nsINavHistoryContainerResultNode) {
NS_ASSERT(curChild.uri, "if there is no uri, we can't persist the open state");
var isopen = curChild.uri &&
PlacesUIUtils.xulStore.hasValue(location, curChild.uri, "open");
if (isopen != curChild.containerOpen)
aToOpen.push(curChild);
else if (curChild.containerOpen && curChild.childCount > 0)
rowsInserted += this._buildVisibleSection(curChild, row + 1, aToOpen);
}
@@ -323,17 +323,17 @@ PlacesTreeView.prototype = {
* will count the node itself plus any child node following it.
*/
_countVisibleRowsForNodeAtRow:
function PTV__countVisibleRowsForNodeAtRow(aNodeRow) {
let node = this._rows[aNodeRow];
// If it's not listed yet, we know that it's a leaf node (instanceof also
// null-checks).
- if (!(node instanceof Components.interfaces.nsINavHistoryContainerResultNode))
+ if (!(node instanceof Ci.nsINavHistoryContainerResultNode))
return 1;
let outerLevel = node.indentLevel;
for (let i = aNodeRow + 1; i < this._rows.length; i++) {
let rowNode = this._rows[i];
if (rowNode && rowNode.indentLevel <= outerLevel)
return i - aNodeRow;
}
@@ -574,21 +574,21 @@ PlacesTreeView.prototype = {
*/
nodeRemoved: function PTV_nodeRemoved(aParentNode, aNode, aOldIndex) {
NS_ASSERT(this._result, "Got a notification but have no result!");
if (!this._tree || !this._result)
return;
// XXX bug 517701: We don't know what to do when the root node is removed.
if (aNode == this._rootNode)
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
let oldRow = this._getRowForNode(aNode, true);
if (oldRow < 0)
- throw Components.results.NS_ERROR_UNEXPECTED;
+ throw Cr.NS_ERROR_UNEXPECTED;
// If the node was exclusively selected, the node next to it will be
// selected.
var selectNext = false;
var selection = this.selection;
if (selection.getRangeCount() == 1) {
let min = { }, max = { };
selection.getRangeAt(0, min, max);
@@ -819,38 +819,38 @@ PlacesTreeView.prototype = {
var columns = this._tree.columns;
// Clear old sorting indicator
var sortedColumn = columns.getSortedColumn();
if (sortedColumn)
sortedColumn.element.removeAttribute("sortDirection");
switch (aSortingMode) {
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING:
columns.Name.element.setAttribute("sortDirection", "ascending");
break;
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TITLE_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_DESCENDING:
columns.Name.element.setAttribute("sortDirection", "descending");
break;
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING:
columns.Date.element.setAttribute("sortDirection", "ascending");
break;
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING:
columns.Date.element.setAttribute("sortDirection", "descending");
break;
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_URI_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_URI_ASCENDING:
columns.URL.element.setAttribute("sortDirection", "ascending");
break;
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_URI_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_URI_DESCENDING:
columns.URL.element.setAttribute("sortDirection", "descending");
break;
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_ASCENDING:
columns.VisitCount.element.setAttribute("sortDirection", "ascending");
break;
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING:
columns.VisitCount.element.setAttribute("sortDirection", "descending");
break;
}
},
_inBatchMode: false,
batching: function PTV_batching(aBatching) {
if (aBatching == this._inBatchMode)
@@ -887,29 +887,29 @@ PlacesTreeView.prototype = {
if (this._tree && val)
this._finishInit();
return val;
},
nodeForTreeIndex: function PTV_nodeForTreeIndex(aIndex) {
if (aIndex > this._rows.length)
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
return this._getNodeForRow(aIndex);
},
treeIndexForNode: function PTV_treeNodeForIndex(aNode) {
// The API allows passing invisible nodes.
try {
return this._getRowForNode(aNode, true);
}
catch(ex) { }
- return Components.interfaces.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE;
+ return Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE;
},
// nsITreeView
get rowCount() {
return this._rows.length;
},
get selection() {
@@ -925,17 +925,17 @@ PlacesTreeView.prototype = {
getCellProperties: function PTV_getCellProperties(aRow, aColumn) {
if (aColumn.id != "Name")
return "";
let node = this._getNodeForRow(aRow);
let properties = this._cellProperties.get(node);
if (!properties) {
properties = "Name";
- if (node.type == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_QUERY) {
+ if (node.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY) {
properties += " query";
if (PlacesUtils.nodeIsDay(node))
properties += " dayContainer";
else if (PlacesUtils.nodeIsHost(node))
properties += " hostContainer";
}
this._cellProperties.set(node, properties);
@@ -978,17 +978,17 @@ PlacesTreeView.prototype = {
// All containers are listed in the rows array.
return !this._rows[aRow].hasChildren;
},
isSeparator: function PTV_isSeparator(aRow) { return false; },
isSorted: function PTV_isSorted() {
return this._result.sortingMode !=
- Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE;
+ Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
},
canDrop: function PTV_canDrop(aRow, aOrientation, aDataTransfer) { return false; },
drop: function PTV_drop(aRow, aOrientation, aDataTransfer) { return; },
getParentIndex: function PTV_getParentIndex(aRow) {
let [parentNode, parentRow] = this._getParentByChildRow(aRow);
return parentRow;
@@ -1086,41 +1086,41 @@ PlacesTreeView.prototype = {
}
if (aTree)
this._finishInit();
}
},
toggleOpenState: function PTV_toggleOpenState(aRow) {
if (!this._result)
- throw Components.results.NS_ERROR_UNEXPECTED;
+ throw Cr.NS_ERROR_UNEXPECTED;
var node = this._rows[aRow];
NS_ASSERT(node.uri, "if there is no uri, we can't persist the open state");
if (node.uri) {
if (node.containerOpen)
PlacesUIUtils.xulStore.removeValue(location, node.uri, "open");
else
PlacesUIUtils.xulStore.setValue(location, node.uri, "open", "true");
}
// 474287 Places enforces title sorting for groups, which we don't want.
if (!node.containerOption && PlacesUtils.asQuery(node).queryOptions.resultType ==
- Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_URI)
+ Ci.nsINavHistoryQueryOptions.RESULTS_AS_URI)
node.queryOptions.sortingMode = this._result.sortingMode;
node.containerOpen = !node.containerOpen;
},
cycleHeader: function PTV_cycleHeader(aColumn) {
if (!this._result)
- throw Components.results.NS_ERROR_UNEXPECTED;
+ throw Cr.NS_ERROR_UNEXPECTED;
var oldSort = this._result.sortingMode;
- const NHQO = Components.interfaces.nsINavHistoryQueryOptions;
+ const NHQO = Ci.nsINavHistoryQueryOptions;
var newSort = NHQO.SORT_BY_NONE;
switch (aColumn.id) {
case "SortAscending":
// this bit-twiddling only subtracts one from even numbers
newSort = (oldSort - 1) | 1;
break;
case "SortDescending":
--- a/suite/common/nsContextMenu.js
+++ b/suite/common/nsContextMenu.js
@@ -78,48 +78,48 @@ nsContextMenu.prototype = {
var popupNode = this.target;
var doc = popupNode.ownerDocument;
var contentType = null;
var contentDisposition = null;
if (this.onImage) {
try {
- let imageCache = Components.classes["@mozilla.org/image/tools;1"]
- .getService(Components.interfaces.imgITools)
- .getImgCacheForDocument(doc);
+ let imageCache = Cc["@mozilla.org/image/tools;1"]
+ .getService(Ci.imgITools)
+ .getImgCacheForDocument(doc);
let props = imageCache.findEntryProperties(popupNode.currentURI);
if (props) {
- let nsISupportsCString = Components.interfaces.nsISupportsCString;
+ let nsISupportsCString = Ci.nsISupportsCString;
contentType = props.get("type", nsISupportsCString).data;
try {
contentDisposition = props.get("content-disposition",
nsISupportsCString).data;
} catch (e) {}
}
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
gContextMenuContentData = {
isRemote: false,
event: aEvent,
popupNode: popupNode,
browser: this.browser,
addonInfo: addonInfo,
documentURIObject: doc.documentURIObject,
docLocation: doc.location.href,
charSet: doc.characterSet,
referrer: doc.referrer,
referrerPolicy: doc.referrerPolicy,
contentType: contentType,
contentDisposition: contentDisposition,
- frameOuterWindowID: doc.defaultView.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindowUtils)
+ frameOuterWindowID: doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils)
.outerWindowID,
};
},
hiding: function () {
gContextMenuContentData = null;
InlineSpellCheckerUI.clearSuggestionsFromMenu();
InlineSpellCheckerUI.clearDictionaryListFromMenu();
@@ -234,19 +234,19 @@ nsContextMenu.prototype = {
this.showItem("context-sep-properties",
!(this.inDirList || this.isContentSelected || this.onTextInput ||
this.onCanvas || this.onVideo || this.onAudio));
// Set Desktop Background depends on whether an image was clicked on,
// and requires the shell service.
var canSetDesktopBackground = false;
if ("@mozilla.org/suite/shell-service;1" in Components.classes) try {
canSetDesktopBackground =
- Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(Components.interfaces.nsIShellService)
- .canSetDesktopBackground;
+ Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(Ci.nsIShellService)
+ .canSetDesktopBackground;
} catch (e) {
}
this.showItem("context-setDesktopBackground",
canSetDesktopBackground && (this.onLoadedImage || this.onStandaloneImage));
this.showItem("context-sep-image",
this.onLoadedImage || this.onStandaloneImage);
@@ -285,17 +285,17 @@ nsContextMenu.prototype = {
// Hide Block and Unblock menuitems.
this.showItem("context-blockimage", false);
this.showItem("context-unblockimage", false);
// Block image depends on whether an image was clicked on.
if (this.onImage) {
var uri = Services.io.newURI(this.mediaURL);
- if (uri instanceof Components.interfaces.nsIURL && uri.host) {
+ if (uri instanceof Ci.nsIURL && uri.host) {
var serverLabel = uri.host;
// Limit length to max 15 characters.
serverLabel = serverLabel.replace(/^www\./i, "");
if (serverLabel.length > 15)
serverLabel = serverLabel.substr(0, 15) + this.ellipsis;
// Set label and accesskey for appropriate action and unhide menuitem.
var id = "context-blockimage";
@@ -326,21 +326,21 @@ nsContextMenu.prototype = {
this.showItem("frame-sep", this.inFrame);
if (this.inFrame)
goSetMenuValue("context-saveframe",
this.autoDownload ? "valueSave" : "valueSaveAs");
var blocking = true;
if (this.popupPrincipal)
try {
- const PM = Components.classes["@mozilla.org/PopupWindowManager;1"]
- .getService(Components.interfaces.nsIPopupWindowManager);
+ const PM = Cc["@mozilla.org/PopupWindowManager;1"]
+ .getService(Ci.nsIPopupWindowManager);
blocking = PM.testPermission(this.popupPrincipal) == PM.DENY_POPUP;
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
this.showItem("popupwindow-reject", this.popupPrincipal && !blocking);
this.showItem("popupwindow-allow", this.popupPrincipal && blocking);
this.showItem("context-sep-popup", this.popupPrincipal);
// BiDi UI
this.showItem("context-sep-bidi", gShowBiDi);
@@ -569,22 +569,22 @@ nsContextMenu.prototype = {
return;
}
this.autoDownload = Services.prefs.getBoolPref("browser.download.useDownloadDir");
// if the document is editable, show context menu like in text inputs
var win = this.target.ownerDocument.defaultView;
if (win) {
- var webNav = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation);
- this.browser = webNav.QueryInterface(Components.interfaces.nsIDocShell)
+ var webNav = win.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation);
+ this.browser = webNav.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
- var editingSession = webNav.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIEditingSession);
+ var editingSession = webNav.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIEditingSession);
if (editingSession.windowIsEditable(win) &&
this.isTargetEditable() && this.target.spellcheck) {
this.onTextInput = true;
this.possibleSpellChecking = true;
InlineSpellCheckerUI.init(editingSession.getEditorForWindow(win));
InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset);
var canSpell = InlineSpellCheckerUI.canSpellCheck;
this.showItem("spell-check-enabled", canSpell);
@@ -593,22 +593,22 @@ nsContextMenu.prototype = {
}
}
// Check if we are in a synthetic document (stand alone image, video, etc.).
this.inSyntheticDoc = this.target.ownerDocument.mozSyntheticDocument;
// First, do checks for nodes that never have children.
if (this.target.nodeType == Node.ELEMENT_NODE) {
// See if the user clicked on an image.
- if (this.target instanceof Components.interfaces.nsIImageLoadingContent &&
+ if (this.target instanceof Ci.nsIImageLoadingContent &&
this.target.currentURI) {
this.onImage = true;
var request =
- this.target.getRequest(Components.interfaces.nsIImageLoadingContent.CURRENT_REQUEST);
+ this.target.getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST);
if (request && (request.imageStatus & request.STATUS_SIZE_AVAILABLE))
this.onLoadedImage = true;
this.mediaURL = this.target.currentURI.spec;
if (this.target.ownerDocument instanceof ImageDocument)
this.onStandaloneImage = true;
}
@@ -632,42 +632,42 @@ nsContextMenu.prototype = {
this.mediaURL = this.target.currentSrc || this.target.src;
}
else if (this.target instanceof HTMLInputElement) {
this.onTextInput = this.isTargetATextBox(this.target);
// allow spellchecking UI on all writable text boxes except passwords
if (this.onTextInput && !this.target.readOnly &&
this.target.mozIsTextField(true) && this.target.spellcheck) {
this.possibleSpellChecking = true;
- InlineSpellCheckerUI.init(this.target.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor);
+ InlineSpellCheckerUI.init(this.target.QueryInterface(Ci.nsIDOMNSEditableElement).editor);
InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset);
}
this.onKeywordField = this.isTargetAKeywordField(this.target);
}
else if (this.target instanceof HTMLTextAreaElement) {
this.onTextInput = this.isTextBoxEnabled(this.target);
if (this.onTextInput && !this.target.readOnly && this.target.spellcheck) {
this.possibleSpellChecking = true;
- InlineSpellCheckerUI.init(this.target.QueryInterface(Components.interfaces.nsIDOMNSEditableElement).editor);
+ InlineSpellCheckerUI.init(this.target.QueryInterface(Ci.nsIDOMNSEditableElement).editor);
InlineSpellCheckerUI.initFromEvent(aRangeParent, aRangeOffset);
}
}
else if ( this.target instanceof HTMLHtmlElement ) {
// pages with multiple <body>s are lame. we'll teach them a lesson.
var bodyElt = this.target.ownerDocument.body;
if (bodyElt) {
var computedURL = this.getComputedURL(bodyElt, "background-image");
if (computedURL) {
this.hasBGImage = true;
this.bgImageURL = makeURLAbsolute(bodyElt.baseURI, computedURL);
}
}
}
else if ("HTTPIndex" in content &&
- content.HTTPIndex instanceof Components.interfaces.nsIHTTPIndex) {
+ content.HTTPIndex instanceof Ci.nsIHTTPIndex) {
this.inDirList = true;
// Bubble outward till we get to an element with URL attribute
// (which should be the href).
var root = this.target;
while (root && !this.link) {
if (root.tagName == "tree") {
// Hit root of tree; must have clicked in empty space;
// thus, no link.
@@ -924,46 +924,46 @@ nsContextMenu.prototype = {
toggleImageSize: function() {
content.document.toggleImageSize();
},
// Reload image
reloadImage: function() {
urlSecurityCheck(this.mediaURL, this.target.nodePrincipal,
- Components.interfaces.nsIScriptSecurityManager.ALLOW_CHROME);
- if (this.target instanceof Components.interfaces.nsIImageLoadingContent)
+ Ci.nsIScriptSecurityManager.ALLOW_CHROME);
+ if (this.target instanceof Ci.nsIImageLoadingContent)
this.target.forceReload();
},
// Change current window to the URL of the image, video, or audio.
viewMedia: function(aEvent) {
var viewURL;
if (this.onCanvas)
viewURL = this.target.toDataURL();
else {
viewURL = this.mediaURL;
urlSecurityCheck(viewURL, this.target.nodePrincipal,
- Components.interfaces.nsIScriptSecurityManager.ALLOW_CHROME);
+ Ci.nsIScriptSecurityManager.ALLOW_CHROME);
}
var doc = this.target.ownerDocument;
var where = whereToOpenLink(aEvent);
if (where == "current")
openTopWin(viewURL, doc.defaultView);
else
openUILinkIn(viewURL, where, null, null, doc.documentURIObject);
},
saveVideoFrameAsImage: function () {
urlSecurityCheck(this.mediaURL, this.browser.contentPrincipal,
- Components.interfaces.nsIScriptSecurityManager.DISALLOW_SCRIPT);
+ Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
var name = "snapshot.jpg";
try {
let uri = makeURI(this.mediaURL);
- let url = uri.QueryInterface(Components.interfaces.nsIURL);
+ let url = uri.QueryInterface(Ci.nsIURL);
if (url.fileBaseName)
name = decodeURI(url.fileBaseName) + ".jpg";
} catch (e) { }
var video = this.target;
var canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
var ctxDraw = canvas.getContext("2d");
@@ -981,17 +981,17 @@ nsContextMenu.prototype = {
openDialog("chrome://communicator/content/fullscreen-video.xhtml",
"", "chrome,centerscreen,dialog=no", this.target, isPaused);
},
// Change current window to the URL of the background image.
viewBGImage: function(aEvent) {
urlSecurityCheck(this.bgImageURL, this.target.nodePrincipal,
- Components.interfaces.nsIScriptSecurityManager.ALLOW_CHROME);
+ Ci.nsIScriptSecurityManager.ALLOW_CHROME);
var doc = this.target.ownerDocument;
var where = whereToOpenLink(aEvent);
if (where == "current")
openTopWin(this.bgImageURL, doc.defaultView);
else
openUILinkIn(this.bgImageURL, where, null, null, doc.documentURIObject);
},
@@ -1045,19 +1045,19 @@ nsContextMenu.prototype = {
const msg = bundle.GetStringFromName("downloadErrorGeneric");
Services.prompt.alert(doc.defaultView, title, msg);
} catch (ex) {}
return;
}
var extHelperAppSvc =
- Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"]
- .getService(Components.interfaces.nsIExternalHelperAppService);
- var channel = aRequest.QueryInterface(Components.interfaces.nsIChannel);
+ Cc["@mozilla.org/uriloader/external-helper-app-service;1"]
+ .getService(Ci.nsIExternalHelperAppService);
+ var channel = aRequest.QueryInterface(Ci.nsIChannel);
this.extListener = extHelperAppSvc.doContent(channel.contentType, aRequest,
doc.defaultView, true);
this.extListener.onStartRequest(aRequest, aContext);
},
onStopRequest: function onStopRequest(aRequest, aContext, aStatusCode) {
if (aStatusCode == NS_ERROR_SAVE_LINK_AS_TIMEOUT) {
// Do it the old fashioned way, which will pick the best filename
@@ -1073,62 +1073,62 @@ nsContextMenu.prototype = {
this.extListener.onDataAvailable(aRequest, aContext, aInputStream,
aOffset, aCount);
}
}
function Callbacks() {}
Callbacks.prototype = {
getInterface: function getInterface(aIID) {
- if (aIID.equals(Components.interfaces.nsIAuthPrompt) ||
- aIID.equals(Components.interfaces.nsIAuthPrompt2)) {
+ if (aIID.equals(Ci.nsIAuthPrompt) ||
+ aIID.equals(Ci.nsIAuthPrompt2)) {
// If the channel demands authentication prompt, we must cancel it
// because the save-as-timer would expire and cancel the channel
// before we get credentials from user. Both authentication dialog
// and save as dialog would appear on the screen as we fall back to
// the old fashioned way after the timeout.
timer.cancel();
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
}
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
}
// If we don't have the headers after a short time the user won't have
// received any feedback from the click. That's bad, so we give up
// waiting for the filename.
function timerCallback() {
channel.cancel(NS_ERROR_SAVE_LINK_AS_TIMEOUT);
}
// set up a channel to do the saving
var ios = Services.io;
var channel = ios.newChannel2(linkURL, null, null, null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
channel.notificationCallbacks = new Callbacks();
- var flags = Components.interfaces.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS;
+ var flags = Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS;
if (bypassCache)
- flags |= Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE;
+ flags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
- if (channel instanceof Components.interfaces.nsICachingChannel)
- flags |= Components.interfaces.nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSY;
+ if (channel instanceof Ci.nsICachingChannel)
+ flags |= Ci.nsICachingChannel.LOAD_BYPASS_LOCAL_CACHE_IF_BUSY;
channel.loadFlags |= flags;
- if (channel instanceof Components.interfaces.nsIPrivateBrowsingChannel)
+ if (channel instanceof Ci.nsIPrivateBrowsingChannel)
channel.setPrivate(gPrivate);
- if (channel instanceof Components.interfaces.nsIHttpChannel) {
+ if (channel instanceof Ci.nsIHttpChannel) {
channel.referrer = doc.documentURIObject;
- if (channel instanceof Components.interfaces.nsIHttpChannelInternal)
+ if (channel instanceof Ci.nsIHttpChannelInternal)
channel.forceAllowThirdPartyCookie = true;
}
// fallback to the old way if we don't see the headers quickly
var timeToWait = Services.prefs.getIntPref("browser.download.saveLinkAsFilenameTimeout");
var timer = setTimeout(timerCallback, timeToWait);
// kick off the channel with our proxy object as the listener
@@ -1167,31 +1167,31 @@ nsContextMenu.prototype = {
getEmail: function() {
// Get the comma-separated list of email addresses only.
// There are other ways of embedding email addresses in a mailto:
// link, but such complex parsing is beyond us.
var addresses;
try {
// Let's try to unescape it using a character set
var characterSet = this.target.ownerDocument.characterSet;
- const textToSubURI = Components.classes["@mozilla.org/intl/texttosuburi;1"]
- .getService(Components.interfaces.nsITextToSubURI);
+ const textToSubURI = Cc["@mozilla.org/intl/texttosuburi;1"]
+ .getService(Ci.nsITextToSubURI);
addresses = this.linkURL.match(/^mailto:([^?]+)/)[1];
addresses = textToSubURI.unEscapeURIForUI(characterSet, addresses);
}
catch(ex) {
// Do nothing.
}
return addresses;
},
// Copy email to clipboard
copyEmail: function() {
var clipboard = this.getService("@mozilla.org/widget/clipboardhelper;1",
- Components.interfaces.nsIClipboardHelper);
+ Ci.nsIClipboardHelper);
clipboard.copyString(this.getEmail());
},
bookmarkThisPage : function() {
window.top.PlacesCommandHook.bookmarkPage(this.browser,
PlacesUtils.bookmarksMenuFolderId,
true);
},
@@ -1226,24 +1226,24 @@ nsContextMenu.prototype = {
},
///////////////
// Utilities //
///////////////
// Create instance of component given contractId and iid (as string).
createInstance: function(aContractId, aIIDName) {
- var iid = Components.interfaces[aIIDName];
- return Components.classes[aContractId].createInstance(iid);
+ var iid = Ci[aIIDName];
+ return Cc[aContractId].createInstance(iid);
},
// Get service given contractId and iid (as string).
getService: function(aContractId, aIIDName) {
- var iid = Components.interfaces[aIIDName];
- return Components.classes[aContractId].getService(iid);
+ var iid = Ci[aIIDName];
+ return Cc[aContractId].getService(iid);
},
// Show/hide one item (specified via name or the item element itself).
showItem: function(aItemOrId, aShow) {
var item = aItemOrId.constructor == String ? document.getElementById(aItemOrId) : aItemOrId;
if (item)
item.hidden = !aShow;
},
@@ -1445,18 +1445,18 @@ nsContextMenu.prototype = {
"contextMenu.onLink = " + this.onLink + "\n" +
"contextMenu.link = " + this.link + "\n" +
"contextMenu.inFrame = " + this.inFrame + "\n" +
"contextMenu.hasBGImage = " + this.hasBGImage + "\n";
},
isTextBoxEnabled: function(aNode) {
return !aNode.ownerDocument.defaultView
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindowUtils)
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils)
.isNodeDisabledForEvents(aNode);
},
isTargetATextBox: function(aNode) {
if (aNode instanceof HTMLInputElement)
return aNode.mozIsTextField(false) && this.isTextBoxEnabled(aNode);
return aNode instanceof HTMLTextAreaElement && this.isTextBoxEnabled(aNode);
@@ -1524,24 +1524,24 @@ nsContextMenu.prototype = {
var showing = aCommand == "showstats";
media.dispatchEvent(new win.CustomEvent("media-showStatistics",
{ bubbles: false, cancelable: true, detail: showing }));
break;
}
},
copyMediaLocation: function() {
- var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper);
+ var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper);
clipboard.copyString(this.mediaURL);
},
get imageURL() {
if (this.onImage)
return this.mediaURL;
return "";
}
};
XPCOMUtils.defineLazyGetter(nsContextMenu.prototype, "ellipsis", function() {
return Services.prefs.getComplexValue("intl.ellipsis",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
});
--- a/suite/common/openLocation.js
+++ b/suite/common/openLocation.js
@@ -86,19 +86,19 @@ function accept()
gOpenAppList.value);
}
SetStringPref(gLastPref, gInput.value);
}
function onChooseFile()
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
+ const nsIFilePicker = Ci.nsIFilePicker;
try {
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, gBundle.getString("chooseFileDialogTitle"), nsIFilePicker.modeOpen);
if (window.arguments[0].action != "5" && gOpenAppList.value == "2") {
// When loading into Composer, direct user to prefer HTML files and text
// files, so we call separately to control the order of the filter list.
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText);
fp.appendFilters(nsIFilePicker.filterAll);
}
else {
--- a/suite/common/permissions/cookieViewer.js
+++ b/suite/common/permissions/cookieViewer.js
@@ -17,46 +17,46 @@ var gDateService = null;
// cookies and permissions list
var cookies = [];
var permissions = [];
var allCookies = [];
var deletedCookies = [];
var deletedPermissions = [];
-const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
-const nsICookiePermission = Components.interfaces.nsICookiePermission;
+const nsIPermissionManager = Ci.nsIPermissionManager;
+const nsICookiePermission = Ci.nsICookiePermission;
var cookieBundle;
var gUpdatingBatch = "";
function Startup() {
// arguments passed to this routine:
// cookieManager
// xpconnect to cookiemanager/permissionmanager/promptservice interfaces
- cookiemanager = Components.classes["@mozilla.org/cookiemanager;1"]
- .getService(Components.interfaces.nsICookieManager);
- permissionmanager = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(Components.interfaces.nsIPermissionManager);
- promptservice = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
+ cookiemanager = Cc["@mozilla.org/cookiemanager;1"]
+ .getService(Ci.nsICookieManager);
+ permissionmanager = Cc["@mozilla.org/permissionmanager;1"]
+ .getService(Ci.nsIPermissionManager);
+ promptservice = Cc["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Ci.nsIPromptService);
// intialize string bundle
cookieBundle = document.getElementById("cookieBundle");
// load in the cookies and permissions
cookiesTree = document.getElementById("cookiesTree");
permissionsTree = document.getElementById("permissionsTree");
loadCookies();
loadPermissions();
// be prepared to reload the display if anything changes
- kObserverService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
+ kObserverService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
kObserverService.addObserver(cookieReloadDisplay, "cookie-changed");
kObserverService.addObserver(cookieReloadDisplay, "perm-changed");
// filter the table if requested by caller
if (window.arguments &&
window.arguments[0] &&
window.arguments[0].filterString)
setFilter(window.arguments[0].filterString);
@@ -86,17 +86,17 @@ var cookieReloadDisplay = {
function doSelectAll() {
var elem = document.commandDispatcher.focusedElement;
if (elem && "treeBoxObject" in elem)
elem.view.selection.selectAll();
}
/*** =================== COOKIES CODE =================== ***/
-const nsICookie = Components.interfaces.nsICookie;
+const nsICookie = Ci.nsICookie;
var cookiesTreeView = {
rowCount : 0,
setTree : function(tree){},
getImageSrc : function(row,column) {},
getProgressMode : function(row,column) {},
getCellValue : function(row,column) {},
getCellText : function(row,column){
@@ -141,17 +141,17 @@ function Cookie(id, host, name, path, or
function loadCookies() {
// load cookies into a table
var enumerator = cookiemanager.enumerator;
var count = 0;
while (enumerator.hasMoreElements()) {
var nextCookie = enumerator.getNext();
if (!nextCookie) break;
- nextCookie = nextCookie.QueryInterface(Components.interfaces.nsICookie);
+ nextCookie = nextCookie.QueryInterface(Ci.nsICookie);
var host = nextCookie.host;
allCookies[count] =
new Cookie(count++, host, nextCookie.name,
nextCookie.path, nextCookie.originAttributes,
nextCookie.value, nextCookie.isDomain,
host.charAt(0)=="." ? host.slice(1) : host,
nextCookie.isSecure, nextCookie.expires);
}
@@ -385,29 +385,29 @@ function Permission(id, principal, type,
function loadPermissions() {
// load permissions into a table
var enumerator = permissionmanager.enumerator;
var canStr = cookieBundle.getString("can");
var canSessionStr = cookieBundle.getString("canSession");
var cannotStr = cookieBundle.getString("cannot");
while (enumerator.hasMoreElements()) {
var nextPermission = enumerator.getNext();
- nextPermission = nextPermission.QueryInterface(Components.interfaces.nsIPermission);
+ nextPermission = nextPermission.QueryInterface(Ci.nsIPermission);
// We are only interested in cookie permissions in this code.
if (nextPermission.type == "cookie") {
// It is currently possible to add a cookie permission for about:xxx and other internal pages.
// They are probably invalid and will be ignored for now.
// Test if the permission has a host.
try {
nextPermission.principal.URI.host;
}
catch (e) {
- Components.utils.reportError("Invalid permission found: " +
- nextPermission.principal.origin + " " +
- nextPermission.type);
+ Cu.reportError("Invalid permission found: " +
+ nextPermission.principal.origin + " " +
+ nextPermission.type);
continue;
}
var capability;
switch (nextPermission.capability) {
case nsIPermissionManager.ALLOW_ACTION:
capability = canStr;
break;
@@ -476,18 +476,18 @@ function setCookiePermissions(action) {
try {
var url = new URL(site.value);
} catch (e) {
// show an error if URL is invalid
window.alert(cookieBundle.getString("allowedURLSchemes"));
return;
}
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
try {
var uri = ioService.newURI(url);
} catch (e) {
// show an error if URI can not be constructed or adding it failed
window.alert(cookieBundle.getString("errorAddPermission"));
return;
}
--- a/suite/common/permissions/permissionsManager.js
+++ b/suite/common/permissions/permissionsManager.js
@@ -1,14 +1,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
-const nsICookiePermission = Components.interfaces.nsICookiePermission;
+const nsIPermissionManager = Ci.nsIPermissionManager;
+const nsICookiePermission = Ci.nsICookiePermission;
var permissionManager;
var additions = [];
var removals = [];
var sortColumn;
var sortAscending;
@@ -39,18 +39,18 @@ var permissionsTree;
var permissionType = "popup";
var gManageCapability;
var permissionsBundle;
function Startup() {
var introText, windowTitle;
- permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(nsIPermissionManager);
+ permissionManager = Cc["@mozilla.org/permissionmanager;1"]
+ .getService(nsIPermissionManager);
permissionsTree = document.getElementById("permissionsTree");
permissionsBundle = document.getElementById("permissionsBundle");
sortAscending = (permissionsTree.getAttribute("sortAscending") == "true");
sortColumn = permissionsTree.getAttribute("sortColumn");
@@ -128,17 +128,17 @@ function btnDisable(aDisabled) {
function loadPermissions() {
var enumerator = permissionManager.enumerator;
var count = 0;
var permission;
try {
while (enumerator.hasMoreElements()) {
- permission = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
+ permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
if (permission.type == permissionType &&
(!gManageCapability || permission.capability == gManageCapability))
permissionPush(count++, permission.host, permission.type,
capabilityString(permission.capability), permission.capability);
}
} catch(ex) {
}
@@ -197,18 +197,18 @@ function deletePermissions() {
}
function deleteAllPermissions() {
DeleteAllFromTree(permissionsTree, permissionsTreeView, additions, removals,
"removePermission", "removeAllPermissions");
}
function finalizeChanges() {
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
var i, p;
for (i in removals) {
p = removals[i];
try {
permissionManager.remove(p.host, p.type);
} catch(ex) {
}
@@ -230,23 +230,23 @@ function handlePermissionKeyPress(e) {
}
}
function addPermission(aPermission) {
var textbox = document.getElementById("url");
// trim any leading and trailing spaces and scheme
var host = trimSpacesAndScheme(textbox.value);
try {
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
var uri = ioService.newURI("http://" + host);
host = uri.host;
} catch(ex) {
- var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
+ var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Ci.nsIPromptService);
var message = permissionsBundle.getFormattedString("alertInvalid", [host]);
var title = permissionsBundle.getString("alertInvalidTitle");
promptService.alert(window, title, message);
textbox.value = "";
textbox.focus();
handleHostInput(textbox);
return;
}
--- a/suite/common/places/browserPlacesViews.js
+++ b/suite/common/places/browserPlacesViews.js
@@ -29,18 +29,18 @@ PlacesViewBase.prototype = {
// The xul element that represents the root container.
_rootElt: null,
// Set to true for views that are represented by native widgets (i.e.
// the native mac menu).
_nativeView: false,
QueryInterface: XPCOMUtils.generateQI(
- [Components.interfaces.nsINavHistoryResultObserver,
- Components.interfaces.nsISupportsWeakReference]),
+ [Ci.nsINavHistoryResultObserver,
+ Ci.nsISupportsWeakReference]),
_place: "",
get place() {
return this._place;
},
set place(val) {
this._place = val;
@@ -150,35 +150,35 @@ PlacesViewBase.prototype = {
},
get insertionPoint() {
// There is no insertion point for history queries, so bail out now and
// save a lot of work when updating commands.
let resultNode = this._resultNode;
if (PlacesUtils.nodeIsQuery(resultNode) &&
PlacesUtils.asQuery(resultNode).queryOptions.queryType ==
- Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
+ Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
return null;
// By default, the insertion point is at the top level, at the end.
let index = PlacesUtils.bookmarks.DEFAULT_INDEX;
let container = this._resultNode;
- let orientation = Components.interfaces.nsITreeView.DROP_BEFORE;
+ let orientation = Ci.nsITreeView.DROP_BEFORE;
let isTag = false;
let selectedNode = this.selectedNode;
if (selectedNode) {
let popup = document.popupNode;
if (!popup._placesNode ||
popup._placesNode == this._resultNode ||
popup._placesNode.itemId == -1) {
// If a static menuitem is selected, or if the root node is selected,
// the insertion point is inside the folder, at the end.
container = selectedNode;
- orientation = Components.interfaces.nsITreeView.DROP_ON;
+ orientation = Ci.nsITreeView.DROP_ON;
}
else {
// In all other cases the insertion point is before that node.
container = selectedNode.parent;
index = container.getChildIndex(selectedNode);
isTag = PlacesUtils.nodeIsTagQuery(container);
}
}
@@ -303,30 +303,30 @@ PlacesViewBase.prototype = {
},
_createMenuItemForPlacesNode:
function PVB__createMenuItemForPlacesNode(aPlacesNode) {
this._domNodes.delete(aPlacesNode);
let element;
let type = aPlacesNode.type;
- if (type == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR)
+ if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR)
element = document.createElement("menuseparator");
else {
- if (type == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_URI) {
+ if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_URI) {
element = document.createElement("menuitem");
element.className = "menuitem-iconic bookmark-item menuitem-with-favicon";
element.setAttribute("scheme",
PlacesUIUtils.guessUrlSchemeForUI(aPlacesNode.uri));
}
else if (PlacesUtils.containerTypes.indexOf(type) != -1) {
element = document.createElement("menu");
element.setAttribute("container", "true");
- if (aPlacesNode.type == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_QUERY) {
+ if (aPlacesNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY) {
element.setAttribute("query", "true");
if (PlacesUtils.nodeIsTagQuery(aPlacesNode))
element.setAttribute("tagContainer", "true");
else if (PlacesUtils.nodeIsDay(aPlacesNode))
element.setAttribute("dayContainer", "true");
else if (PlacesUtils.nodeIsHost(aPlacesNode))
element.setAttribute("hostContainer", "true");
}
@@ -445,19 +445,19 @@ PlacesViewBase.prototype = {
* The livemark container popup
* @param aStatus
* The livemark status
*/
_setLivemarkStatusMenuItem:
function PVB_setLivemarkStatusMenuItem(aPopup, aStatus) {
let itemId = aPopup._placesNode.itemId;
let lmStatus = null;
- if (aStatus == Components.interfaces.mozILivemark.STATUS_LOADING)
+ if (aStatus == Ci.mozILivemark.STATUS_LOADING)
lmStatus = "bookmarksLivemarkLoading";
- else if (aStatus == Components.interfaces.mozILivemark.STATUS_FAILED)
+ else if (aStatus == Ci.mozILivemark.STATUS_FAILED)
lmStatus = "bookmarksLivemarkFailed";
let lmStatusElt = aPopup._lmStatusMenuItem;
if (lmStatus && !lmStatusElt) {
// Create the status menuitem and cache it in the popup object.
lmStatusElt = document.createElement("menuitem");
lmStatusElt.setAttribute("lmStatus", lmStatus);
lmStatusElt.setAttribute("label", PlacesUIUtils.getString(lmStatus));
@@ -638,45 +638,45 @@ PlacesViewBase.prototype = {
elt.remove();
let index = parentElt._startMarker + 1 + aNewIndex;
parentElt.insertBefore(elt, parentElt.childNodes[index]);
}
},
containerStateChanged:
function PVB_containerStateChanged(aPlacesNode, aOldState, aNewState) {
- if (aNewState == Components.interfaces.nsINavHistoryContainerResultNode.STATE_OPENED ||
- aNewState == Components.interfaces.nsINavHistoryContainerResultNode.STATE_CLOSED) {
+ if (aNewState == Ci.nsINavHistoryContainerResultNode.STATE_OPENED ||
+ aNewState == Ci.nsINavHistoryContainerResultNode.STATE_CLOSED) {
this.invalidateContainer(aPlacesNode);
if (PlacesUtils.nodeIsFolder(aPlacesNode) &&
!PlacesUtils.asQuery(this._result.root).queryOptions.excludeItems) {
PlacesUtils.livemarks.getLivemark({ id: aPlacesNode.itemId })
.then(aLivemark => {
let shouldInvalidate =
!this.controller.hasCachedLivemarkInfo(aPlacesNode);
this.controller.cacheLivemarkInfo(aPlacesNode, aLivemark);
- if (aNewState == Components.interfaces.nsINavHistoryContainerResultNode.STATE_OPENED) {
+ if (aNewState == Ci.nsINavHistoryContainerResultNode.STATE_OPENED) {
aLivemark.registerForUpdates(aPlacesNode, this);
aLivemark.reload();
if (shouldInvalidate)
this.invalidateContainer(aPlacesNode);
}
else {
aLivemark.unregisterForUpdates(aPlacesNode);
}
}, () => undefined);
}
}
},
_populateLivemarkPopup: function PVB__populateLivemarkPopup(aPopup)
{
this._setLivemarkSiteURIMenuItem(aPopup);
- this._setLivemarkStatusMenuItem(aPopup, Components.interfaces.mozILivemark.STATUS_LOADING);
+ this._setLivemarkStatusMenuItem(aPopup, Ci.mozILivemark.STATUS_LOADING);
PlacesUtils.livemarks.getLivemark({ id: aPopup._placesNode.itemId })
.then(aLivemark => {
let placesNode = aPopup._placesNode;
if (!placesNode.containerOpen)
return;
this._setLivemarkStatusMenuItem(aPopup, aLivemark.status);
@@ -853,18 +853,18 @@ PlacesToolbar.prototype = {
#ifdef XP_UNIX
#ifndef XP_MACOSX
"mousedown", "mouseup",
#endif
#endif
"mousemove", "mouseover", "mouseout"],
QueryInterface: function PT_QueryInterface(aIID) {
- if (aIID.equals(Components.interfaces.nsIDOMEventListener) ||
- aIID.equals(Components.interfaces.nsITimerCallback))
+ if (aIID.equals(Ci.nsIDOMEventListener) ||
+ aIID.equals(Ci.nsITimerCallback))
return this;
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
},
uninit: function PT_uninit() {
this._removeEventListeners(this._viewElt, this._cbEvents, false);
this._removeEventListeners(this._rootElt, ["popupshowing", "popuphidden"],
@@ -903,17 +903,17 @@ PlacesToolbar.prototype = {
},
_insertNewItem:
function PT__insertNewItem(aChild, aBefore) {
this._domNodes.delete(aChild);
let type = aChild.type;
let button;
- if (type == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
+ if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
button = document.createElement("toolbarseparator");
}
else {
button = document.createElement("toolbarbutton");
button.className = "bookmark-item";
button.setAttribute("label", aChild.title);
let icon = aChild.icon;
if (icon)
@@ -1273,83 +1273,83 @@ PlacesToolbar.prototype = {
// Otherwise, drop before it, with regards to RTL mode.
let threshold = eltRect.width * 0.25;
if (this._isRTL ? (aEvent.clientX > eltRect.right - threshold)
: (aEvent.clientX < eltRect.left + threshold)) {
// Drop before this folder.
dropPoint.ip =
new InsertionPoint(PlacesUtils.getConcreteItemId(this._resultNode),
eltIndex,
- Components.interfaces.nsITreeView.DROP_BEFORE);
+ Ci.nsITreeView.DROP_BEFORE);
dropPoint.beforeIndex = eltIndex;
}
else if (this._isRTL ? (aEvent.clientX > eltRect.left + threshold)
: (aEvent.clientX < eltRect.right - threshold)) {
// Drop inside this folder.
dropPoint.ip =
new InsertionPoint(PlacesUtils.getConcreteItemId(elt._placesNode),
- -1, Components.interfaces.nsITreeView.DROP_ON,
+ -1, Ci.nsITreeView.DROP_ON,
PlacesUtils.nodeIsTagQuery(elt._placesNode));
dropPoint.beforeIndex = eltIndex;
dropPoint.folderElt = elt;
}
else {
// Drop after this folder.
let beforeIndex =
(eltIndex == this._rootElt.childNodes.length - 1) ?
-1 : eltIndex + 1;
dropPoint.ip =
new InsertionPoint(PlacesUtils.getConcreteItemId(this._resultNode),
beforeIndex,
- Components.interfaces.nsITreeView.DROP_BEFORE);
+ Ci.nsITreeView.DROP_BEFORE);
dropPoint.beforeIndex = beforeIndex;
}
}
else {
// This is a non-folder node or a read-only folder.
// Drop before it with regards to RTL mode.
let threshold = eltRect.width * 0.5;
if (this._isRTL ? (aEvent.clientX > eltRect.left + threshold)
: (aEvent.clientX < eltRect.left + threshold)) {
// Drop before this bookmark.
dropPoint.ip =
new InsertionPoint(PlacesUtils.getConcreteItemId(this._resultNode),
eltIndex,
- Components.interfaces.nsITreeView.DROP_BEFORE);
+ Ci.nsITreeView.DROP_BEFORE);
dropPoint.beforeIndex = eltIndex;
}
else {
// Drop after this bookmark.
let beforeIndex =
eltIndex == this._rootElt.childNodes.length - 1 ?
-1 : eltIndex + 1;
dropPoint.ip =
new InsertionPoint(PlacesUtils.getConcreteItemId(this._resultNode),
beforeIndex,
- Components.interfaces.nsITreeView.DROP_BEFORE);
+ Ci.nsITreeView.DROP_BEFORE);
dropPoint.beforeIndex = beforeIndex;
}
}
}
else {
// We are most likely dragging on the empty area of the
// toolbar, we should drop after the last node.
dropPoint.ip =
new InsertionPoint(PlacesUtils.getConcreteItemId(this._resultNode),
- -1, Components.interfaces.nsITreeView.DROP_BEFORE);
+ -1, Ci.nsITreeView.DROP_BEFORE);
dropPoint.beforeIndex = -1;
}
return dropPoint;
},
_setTimer: function PT_setTimer(aTime) {
- let timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ let timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
timer.initWithCallback(this, aTime, timer.TYPE_ONE_SHOT);
return timer;
},
notify: function PT_notify(aTimer) {
if (aTimer == this._updateChevronTimer) {
this._updateChevronTimer = null;
this._updateChevronTimerCallback();
@@ -1611,29 +1611,29 @@ PlacesToolbar.prototype = {
let target = aEvent.target;
if (aEvent.button == 0 &&
target.localName == "toolbarbutton" &&
target.getAttribute("type") == "menu") {
this._allowPopupShowing = false;
// On Linux we can open the popup only after a delay.
// Indeed as soon as the menupopup opens we are unable to start a
// drag aEvent. See bug 500081 for details.
- this._mouseDownTimer = Components.classes["@mozilla.org/timer;1"].
- createInstance(Components.interfaces.nsITimer);
+ this._mouseDownTimer = Cc["@mozilla.org/timer;1"].
+ createInstance(Ci.nsITimer);
let callback = {
_self: this,
_target: target,
notify: function(timer) {
this._target.open = true;
this._mouseDownTimer = null;
}
};
this._mouseDownTimer.initWithCallback(callback, 300,
- Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ Ci.nsITimer.TYPE_ONE_SHOT);
}
},
_onMouseUp: function PT__onMouseUp(aEvent) {
if (aEvent.button != 0)
return;
if (this._mouseDownTimer) {
@@ -1686,17 +1686,17 @@ function PlacesMenu(aPopupShowingEvent,
PlacesViewBase.call(this, aPlace);
this._onPopupShowing(aPopupShowingEvent);
}
PlacesMenu.prototype = {
__proto__: PlacesViewBase.prototype,
QueryInterface: function PM_QueryInterface(aIID) {
- if (aIID.equals(Components.interfaces.nsIDOMEventListener))
+ if (aIID.equals(Ci.nsIDOMEventListener))
return this;
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
},
_removeChild: function PM_removeChild(aChild) {
PlacesViewBase.prototype._removeChild.apply(this, arguments);
if (this._endMarker != -1)
--- a/suite/common/places/controller.js
+++ b/suite/common/places/controller.js
@@ -65,17 +65,17 @@ InsertionPoint.prototype = {
return this._index = val;
},
get index() {
if (this.dropNearItemId > 0) {
// If dropNearItemId is set up we must calculate the real index of
// the item near which we will drop.
var index = PlacesUtils.bookmarks.getItemIndex(this.dropNearItemId);
- return this.orientation == Components.interfaces.nsITreeView.DROP_BEFORE ? index : index + 1;
+ return this.orientation == Ci.nsITreeView.DROP_BEFORE ? index : index + 1;
}
return this._index;
}
};
/**
* Places Controller
*/
@@ -159,31 +159,31 @@ PlacesController.prototype = {
case "placesCmd_new:livemark":
return this._canInsert();
case "placesCmd_new:bookmark":
return this._canInsert();
case "placesCmd_new:separator":
return this._canInsert() &&
!PlacesUtils.asQuery(this._view.result.root).queryOptions.excludeItems &&
this._view.result.sortingMode ==
- Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE;
+ Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
case "placesCmd_show:info":
var selectedNode = this._view.selectedNode;
return selectedNode && PlacesUtils.getConcreteItemId(selectedNode) != -1;
case "placesCmd_reload":
// Livemark containers
var selectedNode = this._view.selectedNode;
return selectedNode && this.hasCachedLivemarkInfo(selectedNode);
case "placesCmd_sortBy:name":
var selectedNode = this._view.selectedNode;
return selectedNode &&
PlacesUtils.nodeIsFolder(selectedNode) &&
!PlacesUIUtils.isContentsReadOnly(selectedNode) &&
this._view.result.sortingMode ==
- Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE;
+ Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
case "placesCmd_createBookmark":
var node = this._view.selectedNode;
return node && PlacesUtils.nodeIsURI(node) && node.itemId == -1;
default:
return false;
}
},
@@ -339,35 +339,35 @@ PlacesController.prototype = {
_isClipboardDataPasteable: function PC__isClipboardDataPasteable() {
// if the clipboard contains TYPE_X_MOZ_PLACE_* data, it is definitely
// pasteable, with no need to unwrap all the nodes.
var flavors = PlacesControllerDragHelper.placesFlavors;
var clipboard = this.clipboard;
var hasPlacesData =
clipboard.hasDataMatchingFlavors(flavors, flavors.length,
- Components.interfaces.nsIClipboard.kGlobalClipboard);
+ Ci.nsIClipboard.kGlobalClipboard);
if (hasPlacesData)
return this._view.insertionPoint != null;
// if the clipboard doesn't have TYPE_X_MOZ_PLACE_* data, we also allow
// pasting of valid "text/unicode" and "text/x-moz-url" data
- var xferable = Components.classes["@mozilla.org/widget/transferable;1"]
- .createInstance(Components.interfaces.nsITransferable);
+ var xferable = Cc["@mozilla.org/widget/transferable;1"]
+ .createInstance(Ci.nsITransferable);
xferable.init(null);
xferable.addDataFlavor(PlacesUtils.TYPE_X_MOZ_URL);
xferable.addDataFlavor(PlacesUtils.TYPE_UNICODE);
- clipboard.getData(xferable, Components.interfaces.nsIClipboard.kGlobalClipboard);
+ clipboard.getData(xferable, Ci.nsIClipboard.kGlobalClipboard);
try {
// getAnyTransferData will throw if no data is available.
var data = { }, type = { };
xferable.getAnyTransferData(type, data, { });
- data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data;
+ data = data.value.QueryInterface(Ci.nsISupportsString).data;
if (type.value != PlacesUtils.TYPE_X_MOZ_URL &&
type.value != PlacesUtils.TYPE_UNICODE)
return false;
// unwrapNodes() will throw if the data blob is malformed.
var unwrappedNodes = PlacesUtils.unwrapNodes(data, type.value);
return this._view.insertionPoint != null;
}
@@ -409,38 +409,38 @@ PlacesController.prototype = {
var nodeData = {};
var node = nodes[i];
var nodeType = node.type;
var uri = null;
// We don't use the nodeIs* methods here to avoid going through the type
// property way too often
switch (nodeType) {
- case Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_QUERY:
+ case Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY:
nodeData["query"] = true;
if (node.parent) {
switch (PlacesUtils.asQuery(node.parent).queryOptions.resultType) {
- case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
+ case Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
nodeData["host"] = true;
break;
- case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
- case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
+ case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
+ case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
nodeData["day"] = true;
break;
}
}
break;
- case Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER:
- case Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT:
+ case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER:
+ case Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT:
nodeData["folder"] = true;
break;
- case Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR:
+ case Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR:
nodeData["separator"] = true;
break;
- case Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_URI:
+ case Ci.nsINavHistoryResultNode.RESULT_TYPE_URI:
nodeData["link"] = true;
uri = PlacesUtils._uri(node.uri);
if (PlacesUtils.nodeIsBookmark(node)) {
nodeData["bookmark"] = true;
PlacesUtils.nodeIsTagQuery(node.parent)
var parentNode = node.parent;
if (parentNode) {
@@ -674,29 +674,29 @@ PlacesController.prototype = {
/**
* Gives the user a chance to cancel loading lots of tabs at once
*/
_confirmOpenTabs: function(numTabsToOpen) {
const kWarnOnOpenPref = "browser.tabs.warnOnOpen";
var reallyOpen = true;
if (Services.prefs.getBoolPref(kWarnOnOpenPref)) {
if (numTabsToOpen >= Services.prefs.getIntPref("browser.tabs.maxOpenBeforeWarn")) {
- var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
+ var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Ci.nsIPromptService);
// default to true: if it were false, we wouldn't get this far
var warnOnOpen = { value: true };
var messageKey = "tabs.openWarningMultipleBranded";
var openKey = "tabs.openButtonMultiple";
const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties";
- var brandShortName = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle(BRANDING_BUNDLE_URI)
- .GetStringFromName("brandShortName");
+ var brandShortName = Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle(BRANDING_BUNDLE_URI)
+ .GetStringFromName("brandShortName");
var buttonPressed = promptService.confirmEx(window,
PlacesUIUtils.getString("tabs.openWarningTitle"),
PlacesUIUtils.getFormattedString(messageKey,
[numTabsToOpen, brandShortName]),
(promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0)
+ (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
PlacesUIUtils.getString(openKey),
@@ -729,17 +729,17 @@ PlacesController.prototype = {
* Shows the Add Bookmark UI for the current insertion point.
*
* @param aType
* the type of the new item (bookmark/livemark/folder)
*/
newItem: function PC_newItem(aType) {
var ip = this._view.insertionPoint;
if (!ip)
- throw Components.results.NS_ERROR_NOT_AVAILABLE;
+ throw Cr.NS_ERROR_NOT_AVAILABLE;
var performed = false;
if (aType == "bookmark")
performed = PlacesUIUtils.showAddBookmarkUI(null, null, null, ip);
else if (aType == "livemark")
performed = PlacesUIUtils.showAddLivemarkUI(null, null, null, null, ip);
else // folder
performed = PlacesUIUtils.showAddFolderUI(null, ip);
@@ -755,17 +755,17 @@ PlacesController.prototype = {
/**
* Create a new Bookmark folder somewhere. Prompts the user for the name
* of the folder.
*/
newFolder: function PC_newFolder() {
var ip = this._view.insertionPoint;
if (!ip)
- throw Components.results.NS_ERROR_NOT_AVAILABLE;
+ throw Cr.NS_ERROR_NOT_AVAILABLE;
var performed = false;
performed = PlacesUIUtils.showAddFolderUI(null, ip);
if (performed) {
// select the new item
var insertedNodeId = PlacesUtils.bookmarks
.getIdForItemAt(ip.itemId, ip.index);
this._view.selectItems([insertedNodeId], false);
@@ -773,17 +773,17 @@ PlacesController.prototype = {
},
/**
* Create a new Bookmark separator somewhere.
*/
newSeparator: function PC_newSeparator() {
var ip = this._view.insertionPoint;
if (!ip)
- throw Components.results.NS_ERROR_NOT_AVAILABLE;
+ throw Cr.NS_ERROR_NOT_AVAILABLE;
var txn = new PlacesCreateSeparatorTransaction(ip.itemId, ip.index);
PlacesUtils.transactionManager.doTransaction(txn);
// select the new item
var insertedNodeId = PlacesUtils.bookmarks
.getIdForItemAt(ip.itemId, ip.index);
this._view.selectItems([insertedNodeId], false);
},
@@ -867,41 +867,41 @@ PlacesController.prototype = {
var tagItemId = PlacesUtils.getConcreteItemId(node.parent);
var uri = PlacesUtils._uri(node.uri);
let txn = new PlacesUntagURITransaction(uri, [tagItemId]);
transactions.push(txn);
}
else if (PlacesUtils.nodeIsTagQuery(node) && node.parent &&
PlacesUtils.nodeIsQuery(node.parent) &&
PlacesUtils.asQuery(node.parent).queryOptions.resultType ==
- Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY) {
+ Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY) {
// This is a tag container.
// Untag all URIs tagged with this tag only if the tag container is
// child of the "Tags" query in the library, in all other places we
// must only remove the query node.
var tag = node.title;
var URIs = PlacesUtils.tagging.getURIsForTag(tag);
for (var j = 0; j < URIs.length; j++) {
let txn = new PlacesUntagURITransaction(URIs[j], [tag]);
transactions.push(txn);
}
}
else if (PlacesUtils.nodeIsURI(node) &&
PlacesUtils.nodeIsQuery(node.parent) &&
PlacesUtils.asQuery(node.parent).queryOptions.queryType ==
- Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
+ Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
// This is a uri node inside an history query.
- var bhist = PlacesUtils.history.QueryInterface(Components.interfaces.nsIBrowserHistory);
+ var bhist = PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory);
bhist.removePage(PlacesUtils._uri(node.uri));
// History deletes are not undoable, so we don't have a transaction.
}
else if (node.itemId == -1 &&
PlacesUtils.nodeIsQuery(node) &&
PlacesUtils.asQuery(node).queryOptions.queryType ==
- Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
+ Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
// This is a dynamically generated history query, like queries
// grouped by site, time or both. Dynamically generated queries don't
// have an itemId even if they are descendants of a bookmark.
this._removeHistoryContainer(node);
// History deletes are not undoable, so we don't have a transaction.
}
else {
// This is a common bookmark item.
@@ -938,31 +938,31 @@ PlacesController.prototype = {
/**
* Removes the set of selected ranges from history.
*/
_removeRowsFromHistory: function PC__removeRowsFromHistory() {
// Other containers are history queries, just delete from history
// history deletes are not undoable.
var nodes = this._view.selectedNodes;
var URIs = [];
- var bhist = PlacesUtils.history.QueryInterface(Components.interfaces.nsIBrowserHistory);
+ var bhist = PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory);
var root = this._view.result.root;
for (var i = 0; i < nodes.length; ++i) {
var node = nodes[i];
if (PlacesUtils.nodeIsURI(node)) {
var uri = PlacesUtils._uri(node.uri);
// avoid trying to delete the same url twice
if (URIs.indexOf(uri) < 0) {
URIs.push(uri);
}
}
else if (PlacesUtils.nodeIsQuery(node) &&
PlacesUtils.asQuery(node).queryOptions.queryType ==
- Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
+ Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
this._removeHistoryContainer(node);
}
// if we have to delete a lot of urls RemovePage will be slow, it's better
// to delete them in bunch and rebuild the full treeView
if (URIs.length > REMOVE_PAGES_MAX_SINGLEREMOVES) {
// do removal in chunks to avoid passing a too big array to removePages
for (var i = 0; i < URIs.length; i += REMOVE_PAGES_CHUNKLEN) {
@@ -982,17 +982,17 @@ PlacesController.prototype = {
},
/**
* Removes history visits for an history container node.
* @param [in] aContainerNode
* The container node to remove.
*/
_removeHistoryContainer: function PC_removeHistoryContainer(aContainerNode) {
- var bhist = PlacesUtils.history.QueryInterface(Components.interfaces.nsIBrowserHistory);
+ var bhist = PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory);
if (PlacesUtils.nodeIsHost(aContainerNode)) {
// Site container.
bhist.removePagesFromHost(aContainerNode.title, true);
}
else if (PlacesUtils.nodeIsDay(aContainerNode)) {
// Day container.
var query = aContainerNode.getQueries()[0];
var beginTime = query.beginTime;
@@ -1020,19 +1020,19 @@ PlacesController.prototype = {
NS_ASSERT(aTxnName !== undefined, "Must supply Transaction Name");
var root = this._view.result.root;
if (PlacesUtils.nodeIsFolder(root))
this._removeRowsFromBookmarks(aTxnName);
else if (PlacesUtils.nodeIsQuery(root)) {
var queryType = PlacesUtils.asQuery(root).queryOptions.queryType;
- if (queryType == Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS)
+ if (queryType == Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS)
this._removeRowsFromBookmarks(aTxnName);
- else if (queryType == Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
+ else if (queryType == Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
this._removeRowsFromHistory();
else
NS_ASSERT(false, "implement support for QUERY_TYPE_UNIFIED");
}
else
NS_ASSERT(false, "unexpected root");
},
@@ -1093,18 +1093,18 @@ PlacesController.prototype = {
let didSuppressNotifications = result.suppressNotifications;
if (!didSuppressNotifications)
result.suppressNotifications = true;
try {
let nodes = this._view.selectedNodes;
- let xferable = Components.classes["@mozilla.org/widget/transferable;1"]
- .createInstance(Components.interfaces.nsITransferable);
+ let xferable = Cc["@mozilla.org/widget/transferable;1"]
+ .createInstance(Ci.nsITransferable);
xferable.init(null);
let foundFolder = false, foundLink = false;
let copiedFolders = [];
let placeString, mozURLString, htmlString, unicodeString;
placeString = mozURLString = htmlString = unicodeString = "";
for (let i = 0; i < nodes.length; ++i) {
let node = nodes[i];
@@ -1150,17 +1150,17 @@ PlacesController.prototype = {
addData(PlacesUtils.TYPE_X_MOZ_URL, mozURLString);
if (unicodeString)
addData(PlacesUtils.TYPE_UNICODE, unicodeString);
if (htmlString)
addData(PlacesUtils.TYPE_HTML, htmlString);
if (placeString || unicodeString || htmlString || mozURLString) {
this.clipboard.setData(xferable, null,
- Components.interfaces.nsIClipboard.kGlobalClipboard);
+ Ci.nsIClipboard.kGlobalClipboard);
}
}
finally {
if (!didSuppressNotifications)
result.suppressNotifications = false;
}
},
@@ -1187,45 +1187,45 @@ PlacesController.prototype = {
* Constructs a transferable that can receive data of specific types.
* @param types
* The types of data the transferable can hold, in order of
* preference.
* @returns The transferable.
*/
function makeXferable(types) {
var xferable =
- Components.classes["@mozilla.org/widget/transferable;1"]
- .createInstance(Components.interfaces.nsITransferable);
+ Cc["@mozilla.org/widget/transferable;1"]
+ .createInstance(Ci.nsITransferable);
xferable.init(null);
for (var i = 0; i < types.length; ++i)
xferable.addDataFlavor(types[i]);
return xferable;
}
var clipboard = this.clipboard;
var ip = this._view.insertionPoint;
if (!ip)
- throw Components.results.NS_ERROR_NOT_AVAILABLE;
+ throw Cr.NS_ERROR_NOT_AVAILABLE;
/**
* Gets a list of transactions to perform the paste of specific types.
* @param types
* The types of data to form paste transactions for
* @returns An array of transactions that perform the paste.
*/
function getTransactions(types) {
var xferable = makeXferable(types);
- clipboard.getData(xferable, Components.interfaces.nsIClipboard.kGlobalClipboard);
+ clipboard.getData(xferable, Ci.nsIClipboard.kGlobalClipboard);
var data = { }, type = { };
try {
xferable.getAnyTransferData(type, data, { });
- data = data.value.QueryInterface(Components.interfaces.nsISupportsString).data;
+ data = data.value.QueryInterface(Ci.nsISupportsString).data;
var items = PlacesUtils.unwrapNodes(data, type.value);
var transactions = [];
var index = ip.index;
for (var i = 0; i < items.length; ++i) {
var txn;
if (ip.isTag) {
var uri = PlacesUtils._uri(items[i].uri);
txn = new PlacesTagURITransaction(uri, [ip.itemId]);
@@ -1390,17 +1390,17 @@ var PlacesControllerDragHelper = {
try {
dragged = PlacesUtils.unwrapNodes(data, flavor)[0];
}
catch (e) {
return false;
}
// Only bookmarks and urls can be dropped into tag containers.
- if (ip.isTag && ip.orientation == Components.interfaces.nsITreeView.DROP_ON &&
+ if (ip.isTag && ip.orientation == Ci.nsITreeView.DROP_ON &&
dragged.type != PlacesUtils.TYPE_X_MOZ_URL &&
(dragged.type != PlacesUtils.TYPE_X_MOZ_PLACE ||
/^place:/.test(dragged.uri)))
return false;
// The following loop disallows the dropping of a folder on itself or
// on any of its descendants.
if (dragged.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER ||
@@ -1479,17 +1479,17 @@ var PlacesControllerDragHelper = {
// elt will be inserted at the same index, each above the previous.
let dragginUp = insertionPoint.itemId == unwrapped.parent &&
index < PlacesUtils.bookmarks.getItemIndex(unwrapped.id);
if (index != -1 && dragginUp)
index+= movedCount++;
// If dragging over a tag container we should tag the item.
if (insertionPoint.isTag &&
- insertionPoint.orientation == Components.interfaces.nsITreeView.DROP_ON) {
+ insertionPoint.orientation == Ci.nsITreeView.DROP_ON) {
let uri = PlacesUtils._uri(unwrapped.uri);
let tagItemId = insertionPoint.itemId;
let tagTxn = new PlacesTagURITransaction(uri, [tagItemId]);
transactions.push(tagTxn);
}
else {
transactions.push(PlacesUIUtils.makeTransaction(unwrapped,
flavor, insertionPoint.itemId,
--- a/suite/common/places/menu.xml
+++ b/suite/common/places/menu.xml
@@ -92,17 +92,17 @@
let eltY = elt.boxObject.y - scrollboxOffset;
let eltHeight = elt.boxObject.height;
if (!elt._placesNode) {
// If we are dragging over a non places node drop at the end.
dropPoint.ip = new InsertionPoint(
PlacesUtils.getConcreteItemId(resultNode),
-1,
- Components.interfaces.nsITreeView.DROP_ON);
+ Ci.nsITreeView.DROP_ON);
// We can set folderElt if we are dropping over a static menu that
// has an internal placespopup.
let isMenu = elt.localName == "menu" ||
(elt.localName == "toolbarbutton" &&
elt.getAttribute("type") == "menu");
if (isMenu && elt.lastChild &&
elt.lastChild.hasAttribute("placespopup"))
dropPoint.folderElt = elt;
@@ -112,49 +112,49 @@
!PlacesUIUtils.isContentsReadOnly(elt._placesNode)) ||
PlacesUtils.nodeIsTagQuery(elt._placesNode)) {
// This is a folder or a tag container.
if (eventY - eltY < eltHeight * 0.20) {
// If mouse is in the top part of the element, drop above folder.
dropPoint.ip = new InsertionPoint(
PlacesUtils.getConcreteItemId(resultNode),
-1,
- Components.interfaces.nsITreeView.DROP_BEFORE,
+ Ci.nsITreeView.DROP_BEFORE,
PlacesUtils.nodeIsTagQuery(elt._placesNode),
elt._placesNode.itemId);
return dropPoint;
}
else if (eventY - eltY < eltHeight * 0.80) {
// If mouse is in the middle of the element, drop inside folder.
dropPoint.ip = new InsertionPoint(
PlacesUtils.getConcreteItemId(elt._placesNode),
-1,
- Components.interfaces.nsITreeView.DROP_ON,
+ Ci.nsITreeView.DROP_ON,
PlacesUtils.nodeIsTagQuery(elt._placesNode));
dropPoint.folderElt = elt;
return dropPoint;
}
}
else if (eventY - eltY <= eltHeight / 2) {
// This is a non-folder node or a readonly folder.
// If the mouse is above the middle, drop above this item.
dropPoint.ip = new InsertionPoint(
PlacesUtils.getConcreteItemId(resultNode),
-1,
- Components.interfaces.nsITreeView.DROP_BEFORE,
+ Ci.nsITreeView.DROP_BEFORE,
PlacesUtils.nodeIsTagQuery(elt._placesNode),
elt._placesNode.itemId);
return dropPoint;
}
// Drop below the item.
dropPoint.ip = new InsertionPoint(
PlacesUtils.getConcreteItemId(resultNode),
-1,
- Components.interfaces.nsITreeView.DROP_AFTER,
+ Ci.nsITreeView.DROP_AFTER,
PlacesUtils.nodeIsTagQuery(elt._placesNode),
elt._placesNode.itemId);
return dropPoint;
]]></body>
</method>
<!-- Sub-menus should be opened when the mouse drags over them, and closed
when the mouse drags off. The overFolder object manages opening and
@@ -198,18 +198,18 @@
get closeMenuTimer() {
return this._closeMenuTimer;
},
set closeMenuTimer(val) {
return this._closeMenuTimer = val;
},
setTimer: function OF__setTimer(aTime) {
- var timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ var timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
timer.initWithCallback(this, aTime, timer.TYPE_ONE_SHOT);
return timer;
},
notify: function OF__notify(aTimer) {
// Function to process all timer notifications.
if (aTimer == this._folder.openTimer) {
--- a/suite/common/places/nsPlacesAutoComplete.js
+++ b/suite/common/places/nsPlacesAutoComplete.js
@@ -620,18 +620,18 @@ nsPlacesAutoComplete.prototype = {
// Notify about results if we've gotten them.
if (haveMatches) {
this._notifyResults(true);
}
},
handleError: function PAC_handleError(aError)
{
- Components.utils.reportError("Places AutoComplete: An async statement encountered an " +
- "error: " + aError.result + ", '" + aError.message + "'");
+ Cu.reportError("Places AutoComplete: An async statement encountered an " +
+ "error: " + aError.result + ", '" + aError.message + "'");
},
handleCompletion: function PAC_handleCompletion(aReason)
{
// If we have already finished our search, we should bail out early.
if (this.isSearchComplete()) {
return;
}
--- a/suite/common/places/tests/autocomplete/test_autocomplete_on_value_removed_479089.js
+++ b/suite/common/places/tests/autocomplete/test_autocomplete_on_value_removed_479089.js
@@ -19,17 +19,17 @@ function run_test()
{
run_next_test();
}
add_task(async function test_autocomplete_on_value_removed()
{
// QI to nsIAutoCompleteSimpleResultListener
var listener = Cc["@mozilla.org/autocomplete/search;1?name=history"].
- getService(Components.interfaces.nsIAutoCompleteSimpleResultListener);
+ getService(Ci.nsIAutoCompleteSimpleResultListener);
// add history visit
var testUri = uri("http://foo.mozilla.com/");
await PlacesTestUtils.addVisits({
uri: testUri,
referrer: uri("http://mozilla.com/")
});
// create a query object
--- a/suite/common/places/tree.xml
+++ b/suite/common/places/tree.xml
@@ -33,18 +33,18 @@
readonly="true"
onget="return this._controller"/>
<!-- overriding -->
<property name="view">
<getter><![CDATA[
try {
return this.treeBoxObject.view
- .QueryInterface(Components.interfaces.nsITreeView)
- .QueryInterface(Components.interfaces.nsINavHistoryResultTreeViewer);
+ .QueryInterface(Ci.nsITreeView)
+ .QueryInterface(Ci.nsINavHistoryResultTreeViewer);
}
catch(e) {
return null;
}
]]></getter>
<setter><![CDATA[
return this.treeBoxObject.view = val;
]]></setter>
@@ -217,38 +217,38 @@
parents.push(parent);
parent = parent.parent;
}
// Walk the list backwards (opening from the root of the hierarchy)
// opening each folder as we go.
for (var i = parents.length - 1; i >= 0; --i) {
var index = view.treeIndexForNode(parents[i]);
- if (index != Components.interfaces.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE &&
+ if (index != Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE &&
view.isContainer(index) && !view.isContainerOpen(index))
view.toggleOpenState(index);
}
// Select the specified node...
}
var index = view.treeIndexForNode(node);
- if (index == Components.interfaces.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE)
+ if (index == Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE)
return;
view.selection.select(index);
// ... and ensure it's visible, not scrolled off somewhere.
this.treeBoxObject.ensureRowIsVisible(index);
]]></body>
</method>
<!-- nsIPlacesView -->
<property name="result">
<getter><![CDATA[
try {
- return this.view.QueryInterface(Components.interfaces.nsINavHistoryResultObserver).result;
+ return this.view.QueryInterface(Ci.nsINavHistoryResultObserver).result;
}
catch (e) {
return null;
}
]]></getter>
</property>
<!-- nsIPlacesView -->
@@ -384,20 +384,20 @@
if (this._cachedInsertionPoint !== undefined)
return this._cachedInsertionPoint;
// there is no insertion point for history queries
// so bail out now and save a lot of work when updating commands
var resultNode = this.result.root;
if (PlacesUtils.nodeIsQuery(resultNode) &&
PlacesUtils.asQuery(resultNode).queryOptions.queryType ==
- Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
+ Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY)
return this._cachedInsertionPoint = null;
- var orientation = Components.interfaces.nsITreeView.DROP_BEFORE;
+ var orientation = Ci.nsITreeView.DROP_BEFORE;
// If there is no selection, insert at the end of the container.
if (!this.hasSelection) {
var index = this.view.rowCount - 1;
this._cachedInsertionPoint =
this._getInsertionPoint(index, orientation);
return this._cachedInsertionPoint;
}
@@ -427,17 +427,17 @@
// container, insert _adjacent_ to the selection.
//
// If the sole selection is the bookmarks toolbar folder, we insert
// into it even if it is not opened
var itemId =
PlacesUtils.getConcreteItemId(resultView.nodeForTreeIndex(max.value));
if (selection.count == 1 && resultView.isContainer(max.value) &&
!this.flatList)
- orientation = Components.interfaces.nsITreeView.DROP_ON;
+ orientation = Ci.nsITreeView.DROP_ON;
this._cachedInsertionPoint =
this._getInsertionPoint(max.value, orientation);
return this._cachedInsertionPoint;
]]></getter>
</property>
<method name="_getInsertionPoint">
@@ -448,29 +448,29 @@
var resultview = this.view;
var container = result.root;
var dropNearItemId = -1;
NS_ASSERT(container, "null container");
// When there's no selection, assume the container is the container
// the view is populated from (i.e. the result's itemId).
if (index != -1) {
var lastSelected = resultview.nodeForTreeIndex(index);
- if (resultview.isContainer(index) && orientation == Components.interfaces.nsITreeView.DROP_ON) {
+ if (resultview.isContainer(index) && orientation == Ci.nsITreeView.DROP_ON) {
// If the last selected item is an open container, append _into_
// it, rather than insert adjacent to it.
container = lastSelected;
index = -1;
}
else if (lastSelected.containerOpen &&
- orientation == Components.interfaces.nsITreeView.DROP_AFTER &&
+ orientation == Ci.nsITreeView.DROP_AFTER &&
lastSelected.hasChildren) {
// If the last selected item is an open container and the user is
// trying to drag into it as a first item, really insert into it.
container = lastSelected;
- orientation = Components.interfaces.nsITreeView.DROP_ON;
+ orientation = Ci.nsITreeView.DROP_ON;
index = 0;
}
else {
// Use the last-selected node's container.
container = lastSelected.parent;
// See comment in the treeView.js's copy of this method
if (!container || !container.containerOpen)
@@ -478,32 +478,32 @@
// Avoid the potentially expensive call to getChildIndex
// if we know this container doesn't allow insertion
if (PlacesControllerDragHelper.disallowInsertion(container))
return null;
var queryOptions = PlacesUtils.asQuery(result.root).queryOptions;
if (queryOptions.sortingMode !=
- Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE) {
+ Ci.nsINavHistoryQueryOptions.SORT_BY_NONE) {
// If we are within a sorted view, insert at the end
index = -1;
}
else if (queryOptions.excludeItems ||
queryOptions.excludeQueries ||
queryOptions.excludeReadOnlyFolders) {
// Some item may be invisible, insert near last selected one.
// We don't replace index here to avoid requests to the db,
// instead it will be calculated later by the controller.
index = -1;
dropNearItemId = lastSelected.itemId;
}
else {
var lsi = container.getChildIndex(lastSelected);
- index = orientation == Components.interfaces.nsITreeView.DROP_BEFORE ? lsi : lsi + 1;
+ index = orientation == Ci.nsITreeView.DROP_BEFORE ? lsi : lsi + 1;
}
}
}
if (PlacesControllerDragHelper.disallowInsertion(container))
return null;
return new InsertionPoint(PlacesUtils.getConcreteItemId(container),
@@ -558,17 +558,17 @@
*/
function findNodes(node) {
var foundOne = false;
// See if node matches an ID we wanted; add to results.
// For simple folder queries, check both itemId and the concrete
// item id.
var index = ids.indexOf(node.itemId);
if (index == -1 &&
- node.type == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT)
+ node.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT)
index = ids.indexOf(PlacesUtils.asQuery(node).folderItemId);
if (index != -1) {
nodes.push(node);
foundOne = true;
ids.splice(index, 1);
}
@@ -622,17 +622,17 @@
selection.selectEventsSuppressed = true;
selection.clearSelection();
// Open nodes containing found items
for (var i = 0; i < nodesToOpen.length; i++) {
nodesToOpen[i].containerOpen = true;
}
for (var i = 0; i < nodes.length; i++) {
var index = resultview.treeIndexForNode(nodes[i]);
- if (index == Components.interfaces.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE)
+ if (index == Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE)
continue;
selection.rangedSelect(index, index, true);
}
selection.selectEventsSuppressed = false;
]]></body>
</method>
<field name="_contextMenuShown">false</field>
@@ -713,33 +713,33 @@
// We have to calculate the orientation since view.canDrop will use
// it and we want to be consistent with the dropfeedback.
let tbo = this.treeBoxObject;
let rowHeight = tbo.rowHeight;
let eventY = event.clientY - tbo.treeBody.boxObject.y -
rowHeight * (cell.row - tbo.getFirstVisibleRow());
- let orientation = Components.interfaces.nsITreeView.DROP_BEFORE;
+ let orientation = Ci.nsITreeView.DROP_BEFORE;
if (cell.row == -1) {
// If the row is not valid we try to insert inside the resultNode.
- orientation = Components.interfaces.nsITreeView.DROP_ON;
+ orientation = Ci.nsITreeView.DROP_ON;
}
else if (PlacesUtils.nodeIsContainer(node) &&
eventY > rowHeight * 0.75) {
// If we are below the 75% of a container the treeview we try
// to drop after the node.
- orientation = Components.interfaces.nsITreeView.DROP_AFTER;
+ orientation = Ci.nsITreeView.DROP_AFTER;
}
else if (PlacesUtils.nodeIsContainer(node) &&
eventY > rowHeight * 0.25) {
// If we are below the 25% of a container the treeview we try
// to drop inside the node.
- orientation = Components.interfaces.nsITreeView.DROP_ON;
+ orientation = Ci.nsITreeView.DROP_ON;
}
if (!this.view.canDrop(cell.row, orientation, event.dataTransfer))
return;
event.preventDefault();
event.stopPropagation();
]]></handler>
--- a/suite/common/places/treeView.js
+++ b/suite/common/places/treeView.js
@@ -41,24 +41,24 @@ function PlacesTreeView(aFlatList, aOnOp
this._flatList = aFlatList;
this._openContainerCallback = aOnOpenFlatContainer;
this._controller = aController;
}
PlacesTreeView.prototype = {
QueryInterface: function PTV_QueryInterface(aIID) {
- if (aIID.equals(Components.interfaces.nsITreeView) ||
- aIID.equals(Components.interfaces.nsINavHistoryResultObserver) ||
- aIID.equals(Components.interfaces.nsINavHistoryResultTreeViewer) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsITreeView) ||
+ aIID.equals(Ci.nsINavHistoryResultObserver) ||
+ aIID.equals(Ci.nsINavHistoryResultTreeViewer) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
/**
* This is called once both the result and the tree are set.
*/
_finishInit: function PTV__finishInit() {
let selection = this.selection;
if (selection)
@@ -100,31 +100,31 @@ PlacesTreeView.prototype = {
* @return true if aContainer is a plain container, false otherwise.
*/
_isPlainContainer: function PTV__isPlainContainer(aContainer) {
// Livemarks are always plain containers.
if (this._controller.hasCachedLivemarkInfo(aContainer))
return true;
// We don't know enough about non-query containers.
- if (!(aContainer instanceof Components.interfaces.nsINavHistoryQueryResultNode))
+ if (!(aContainer instanceof Ci.nsINavHistoryQueryResultNode))
return false;
switch (aContainer.queryOptions.resultType) {
- case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
- case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
- case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
- case Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY:
+ case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_QUERY:
+ case Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY:
+ case Ci.nsINavHistoryQueryOptions.RESULTS_AS_DATE_SITE_QUERY:
+ case Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY:
return false;
}
// If it's a folder, it's not a plain container.
let nodeType = aContainer.type;
- return nodeType != Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER &&
- nodeType != Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT;
+ return nodeType != Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER &&
+ nodeType != Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT;
},
/**
* Gets the row number for a given node. Assumes that the given node is
* visible (i.e. it's not an obsolete node).
*
* @param aNode
* A result node. Do not pass an obsolete node, or any
@@ -251,17 +251,17 @@ PlacesTreeView.prototype = {
let newNode = this._rootNode.getChild(aRow);
this._nodeDetails.delete(makeNodeDetailsKey(this._rows[aRow]));
this._nodeDetails.set(makeNodeDetailsKey(newNode), newNode);
return this._rows[aRow] = newNode;
}
// Unset elements may exist only in plain containers. Thus, if the nearest
// node is a container, it's the row's parent, otherwise, it's a sibling.
- if (rowNode instanceof Components.interfaces.nsINavHistoryContainerResultNode) {
+ if (rowNode instanceof Ci.nsINavHistoryContainerResultNode) {
let newNode = rowNode.getChild(aRow - row - 1);
this._nodeDetails.delete(makeNodeDetailsKey(this._rows[aRow]));
this._nodeDetails.set(makeNodeDetailsKey(newNode), newNode);
return this._rows[aRow] = newNode;
}
let [parent, parentRow] = this._getParentByChildRow(row);
let newNode = parent.getChild(aRow - parentRow - 1);
@@ -314,35 +314,35 @@ PlacesTreeView.prototype = {
let rowsInserted = 0;
for (let i = 0; i < cc; i++) {
let curChild = aContainer.getChild(i);
let curChildType = curChild.type;
let row = aFirstChildRow + rowsInserted;
// Don't display separators when sorted.
- if (curChildType == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
- if (sortingMode != Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE) {
+ if (curChildType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
+ if (sortingMode != Ci.nsINavHistoryQueryOptions.SORT_BY_NONE) {
// Remove the element for the filtered separator.
// Notice that the rows array was initially resized to include all
// children.
this._nodeDetails.delete(makeNodeDetailsKey(this._rows[row]));
this._rows.splice(row, 1);
continue;
}
}
this._nodeDetails.delete(makeNodeDetailsKey(this._rows[row]));
this._nodeDetails.set(makeNodeDetailsKey(curChild), curChild);
this._rows[row] = curChild;
rowsInserted++;
// Recursively do containers.
if (!this._flatList &&
- curChild instanceof Components.interfaces.nsINavHistoryContainerResultNode &&
+ curChild instanceof Ci.nsINavHistoryContainerResultNode &&
!this._controller.hasCachedLivemarkInfo(curChild)) {
NS_ASSERT(curChild.uri, "if there is no uri, we can't persist the open state");
let isopen = curChild.uri &&
PlacesUIUtils.xulStore.hasValue(location, curChild.uri, "open");
if (isopen != curChild.containerOpen)
aToOpen.push(curChild);
else if (curChild.containerOpen && curChild.childCount > 0)
rowsInserted += this._buildVisibleSection(curChild, row + 1, aToOpen);
@@ -357,17 +357,17 @@ PlacesTreeView.prototype = {
* will count the node itself plus any child node following it.
*/
_countVisibleRowsForNodeAtRow:
function PTV__countVisibleRowsForNodeAtRow(aNodeRow) {
let node = this._rows[aNodeRow];
// If it's not listed yet, we know that it's a leaf node (instanceof also
// null-checks).
- if (!(node instanceof Components.interfaces.nsINavHistoryContainerResultNode))
+ if (!(node instanceof Ci.nsINavHistoryContainerResultNode))
return 1;
let outerLevel = node.indentLevel;
for (let i = aNodeRow + 1; i < this._rows.length; i++) {
let rowNode = this._rows[i];
if (rowNode && rowNode.indentLevel <= outerLevel)
return i - aNodeRow;
}
@@ -576,54 +576,54 @@ PlacesTreeView.prototype = {
case "tags":
return this.COLUMN_TYPE_TAGS;
}
return this.COLUMN_TYPE_UNKNOWN;
},
_sortTypeToColumnType: function PTV__sortTypeToColumnType(aSortType) {
switch (aSortType) {
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING:
return [this.COLUMN_TYPE_TITLE, false];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TITLE_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_DESCENDING:
return [this.COLUMN_TYPE_TITLE, true];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_ASCENDING:
return [this.COLUMN_TYPE_DATE, false];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING:
return [this.COLUMN_TYPE_DATE, true];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_URI_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_URI_ASCENDING:
return [this.COLUMN_TYPE_URI, false];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_URI_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_URI_DESCENDING:
return [this.COLUMN_TYPE_URI, true];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_ASCENDING:
return [this.COLUMN_TYPE_VISITCOUNT, false];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING:
return [this.COLUMN_TYPE_VISITCOUNT, true];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_KEYWORD_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_KEYWORD_ASCENDING:
return [this.COLUMN_TYPE_KEYWORD, false];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_KEYWORD_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_KEYWORD_DESCENDING:
return [this.COLUMN_TYPE_KEYWORD, true];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_ASCENDING:
if (this._result.sortingAnnotation == PlacesUIUtils.DESCRIPTION_ANNO)
return [this.COLUMN_TYPE_DESCRIPTION, false];
break;
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_ANNOTATION_DESCENDING:
if (this._result.sortingAnnotation == PlacesUIUtils.DESCRIPTION_ANNO)
return [this.COLUMN_TYPE_DESCRIPTION, true];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_ASCENDING:
return [this.COLUMN_TYPE_DATEADDED, false];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING:
return [this.COLUMN_TYPE_DATEADDED, true];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_ASCENDING:
return [this.COLUMN_TYPE_LASTMODIFIED, false];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_DESCENDING:
return [this.COLUMN_TYPE_LASTMODIFIED, true];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TAGS_ASCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_TAGS_ASCENDING:
return [this.COLUMN_TYPE_TAGS, false];
- case Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TAGS_DESCENDING:
+ case Ci.nsINavHistoryQueryOptions.SORT_BY_TAGS_DESCENDING:
return [this.COLUMN_TYPE_TAGS, true];
}
return [this.COLUMN_TYPE_UNKNOWN, false];
},
// nsINavHistoryResultObserver
nodeInserted: function PTV_nodeInserted(aParentNode, aNode, aNewIndex) {
NS_ASSERT(this._result, "Got a notification but have no result!");
@@ -700,27 +700,27 @@ PlacesTreeView.prototype = {
*/
nodeRemoved: function PTV_nodeRemoved(aParentNode, aNode, aOldIndex) {
NS_ASSERT(this._result, "Got a notification but have no result!");
if (!this._tree || !this._result)
return;
// XXX bug 517701: We don't know what to do when the root node is removed.
if (aNode == this._rootNode)
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
// Bail out for hidden separators.
if (PlacesUtils.nodeIsSeparator(aNode) && this.isSorted())
return;
let parentRow = aParentNode == this._rootNode ?
undefined : this._getRowForNode(aParentNode, true);
let oldRow = this._getRowForNode(aNode, true, parentRow, aOldIndex);
if (oldRow < 0)
- throw Components.results.NS_ERROR_UNEXPECTED;
+ throw Cr.NS_ERROR_UNEXPECTED;
// If the node was exclusively selected, the node next to it will be
// selected.
let selectNext = false;
let selection = this.selection;
if (selection.getRangeCount() == 1) {
let min = { }, max = { };
selection.getRangeAt(0, min, max);
@@ -926,17 +926,17 @@ PlacesTreeView.prototype = {
if (PlacesUtils.asQuery(this._rootNode).queryOptions.excludeItems)
return;
PlacesUtils.livemarks.getLivemark({ id: aNode.itemId })
.then(aLivemark => {
let shouldInvalidate =
!this._controller.hasCachedLivemarkInfo(aNode);
this._controller.cacheLivemarkInfo(aNode, aLivemark);
- if (aNewState == Components.interfaces.nsINavHistoryContainerResultNode.STATE_OPENED) {
+ if (aNewState == Ci.nsINavHistoryContainerResultNode.STATE_OPENED) {
aLivemark.registerForUpdates(aNode, this);
aLivemark.reload();
if (shouldInvalidate)
this.invalidateContainer(aNode);
}
else {
aLivemark.unregisterForUpdates(aNode);
}
@@ -1079,17 +1079,17 @@ PlacesTreeView.prototype = {
let columns = this._tree.columns;
// Clear old sorting indicator.
let sortedColumn = columns.getSortedColumn();
if (sortedColumn)
sortedColumn.element.removeAttribute("sortDirection");
// Set new sorting indicator by looking through all columns for ours.
- if (aSortingMode == Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE)
+ if (aSortingMode == Ci.nsINavHistoryQueryOptions.SORT_BY_NONE)
return;
let [desiredColumn, desiredIsDescending] =
this._sortTypeToColumnType(aSortingMode);
let colCount = columns.count;
let column = this._findColumnByType(desiredColumn);
if (column) {
let sortDir = desiredIsDescending ? "descending" : "ascending";
@@ -1133,29 +1133,29 @@ PlacesTreeView.prototype = {
if (this._tree && val)
this._finishInit();
return val;
},
nodeForTreeIndex: function PTV_nodeForTreeIndex(aIndex) {
if (aIndex > this._rows.length)
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
return this._getNodeForRow(aIndex);
},
treeIndexForNode: function PTV_treeNodeForIndex(aNode) {
// The API allows passing invisible nodes.
try {
return this._getRowForNode(aNode, true);
}
catch(ex) { }
- return Components.interfaces.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE;
+ return Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE;
},
// nsITreeView
get rowCount() {
return this._rows.length;
},
get selection() {
@@ -1181,27 +1181,27 @@ PlacesTreeView.prototype = {
let node = this._getNodeForRow(aRow);
let properties = this._cellProperties.get(node);
if (!properties) {
properties = "title";
let itemId = node.itemId;
let nodeType = node.type;
if (PlacesUtils.containerTypes.indexOf(nodeType) != -1) {
- if (nodeType == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_QUERY) {
+ if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY) {
properties += " query";
if (PlacesUtils.nodeIsTagQuery(node))
properties += " tagContainer";
else if (PlacesUtils.nodeIsDay(node))
properties += " dayContainer";
else if (PlacesUtils.nodeIsHost(node))
properties += " hostContainer";
}
- else if (nodeType == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER ||
- nodeType == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT) {
+ else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER ||
+ nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT) {
if (this._controller.hasCachedLivemarkInfo(node))
properties += " livemark";
else {
PlacesUtils.livemarks.getLivemark({ id: node.itemId })
.then(aLivemark => {
this._controller.cacheLivemarkInfo(node, aLivemark);
properties += " livemark";
this._cellProperties.set(node, properties);
@@ -1212,17 +1212,17 @@ PlacesTreeView.prototype = {
}
if (itemId != -1) {
let queryName = PlacesUIUtils.getLeftPaneQueryNameFromId(itemId);
if (queryName)
properties += " OrganizerQuery_" + queryName;
}
}
- else if (nodeType == Components.interfaces.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR)
+ else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR)
properties += " separator";
else if (PlacesUtils.nodeIsURI(node)) {
properties += " " + PlacesUIUtils.guessUrlSchemeForUI(node.uri);
if (this._controller.hasCachedLivemarkInfo(node.parent)) {
properties += " livemarkItem";
if (node.accessCount)
properties += " visited";
}
@@ -1282,51 +1282,51 @@ PlacesTreeView.prototype = {
isSeparator: function PTV_isSeparator(aRow) {
// All separators are listed in the rows array.
let node = this._rows[aRow];
return node && PlacesUtils.nodeIsSeparator(node);
},
isSorted: function PTV_isSorted() {
return this._result.sortingMode !=
- Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE;
+ Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
},
canDrop: function PTV_canDrop(aRow, aOrientation, aDataTransfer) {
if (!this._result)
- throw Components.results.NS_ERROR_UNEXPECTED;
+ throw Cr.NS_ERROR_UNEXPECTED;
// Drop position into a sorted treeview would be wrong.
if (this.isSorted())
return false;
let ip = this._getInsertionPoint(aRow, aOrientation);
return ip && PlacesControllerDragHelper.canDrop(ip, aDataTransfer);
},
_getInsertionPoint: function PTV__getInsertionPoint(index, orientation) {
let container = this._result.root;
let dropNearItemId = -1;
// When there's no selection, assume the container is the container
// the view is populated from (i.e. the result's itemId).
if (index != -1) {
let lastSelected = this.nodeForTreeIndex(index);
- if (this.isContainer(index) && orientation == Components.interfaces.nsITreeView.DROP_ON) {
+ if (this.isContainer(index) && orientation == Ci.nsITreeView.DROP_ON) {
// If the last selected item is an open container, append _into_
// it, rather than insert adjacent to it.
container = lastSelected;
index = -1;
}
else if (lastSelected.containerOpen &&
- orientation == Components.interfaces.nsITreeView.DROP_AFTER &&
+ orientation == Ci.nsITreeView.DROP_AFTER &&
lastSelected.hasChildren) {
// If the last selected node is an open container and the user is
// trying to drag into it as a first node, really insert into it.
container = lastSelected;
- orientation = Components.interfaces.nsITreeView.DROP_ON;
+ orientation = Ci.nsITreeView.DROP_ON;
index = 0;
}
else {
// Use the last-selected node's container.
container = lastSelected.parent;
// During its Drag & Drop operation, the tree code closes-and-opens
// containers very often (part of the XUL "spring-loaded folders"
@@ -1339,32 +1339,32 @@ PlacesTreeView.prototype = {
// Avoid the potentially expensive call to getChildIndex
// if we know this container doesn't allow insertion.
if (PlacesControllerDragHelper.disallowInsertion(container))
return null;
let queryOptions = PlacesUtils.asQuery(this._result.root).queryOptions;
if (queryOptions.sortingMode !=
- Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_NONE) {
+ Ci.nsINavHistoryQueryOptions.SORT_BY_NONE) {
// If we are within a sorted view, insert at the end.
index = -1;
}
else if (queryOptions.excludeItems ||
queryOptions.excludeQueries ||
queryOptions.excludeReadOnlyFolders) {
// Some item may be invisible, insert near last selected one.
// We don't replace index here to avoid requests to the db,
// instead it will be calculated later by the controller.
index = -1;
dropNearItemId = lastSelected.itemId;
}
else {
let lsi = container.getChildIndex(lastSelected);
- index = orientation == Components.interfaces.nsITreeView.DROP_BEFORE ? lsi : lsi + 1;
+ index = orientation == Ci.nsITreeView.DROP_BEFORE ? lsi : lsi + 1;
}
}
}
if (PlacesControllerDragHelper.disallowInsertion(container))
return null;
return new InsertionPoint(PlacesUtils.getConcreteItemId(container),
@@ -1508,17 +1508,17 @@ PlacesTreeView.prototype = {
}
if (aTree)
this._finishInit();
}
},
toggleOpenState: function PTV_toggleOpenState(aRow) {
if (!this._result)
- throw Components.results.NS_ERROR_UNEXPECTED;
+ throw Cr.NS_ERROR_UNEXPECTED;
let node = this._rows[aRow];
if (this._flatList && this._openContainerCallback) {
this._openContainerCallback(node);
return;
}
// Persist container open state, except for livemarks.
@@ -1532,17 +1532,17 @@ PlacesTreeView.prototype = {
}
}
node.containerOpen = !node.containerOpen;
},
cycleHeader: function PTV_cycleHeader(aColumn) {
if (!this._result)
- throw Components.results.NS_ERROR_UNEXPECTED;
+ throw Cr.NS_ERROR_UNEXPECTED;
// Sometimes you want a tri-state sorting, and sometimes you don't. This
// rule allows tri-state sorting when the root node is a folder. This will
// catch the most common cases. When you are looking at folders, you want
// the third state to reset the sorting to the natural bookmark order. When
// you are looking at history, that third state has no meaning so we try
// to disallow it.
//
@@ -1551,17 +1551,17 @@ PlacesTreeView.prototype = {
// this rule doesn't allow you to sort those sub-folders by their natural
// order.
let allowTriState = PlacesUtils.nodeIsFolder(this._result.root);
let oldSort = this._result.sortingMode;
let oldSortingAnnotation = this._result.sortingAnnotation;
let newSort;
let newSortingAnnotation = "";
- const NHQO = Components.interfaces.nsINavHistoryQueryOptions;
+ const NHQO = Ci.nsINavHistoryQueryOptions;
switch (this._getColumnType(aColumn)) {
case this.COLUMN_TYPE_TITLE:
if (oldSort == NHQO.SORT_BY_TITLE_ASCENDING)
newSort = NHQO.SORT_BY_TITLE_DESCENDING;
else if (allowTriState && oldSort == NHQO.SORT_BY_TITLE_DESCENDING)
newSort = NHQO.SORT_BY_NONE;
else
newSort = NHQO.SORT_BY_TITLE_ASCENDING;
@@ -1648,30 +1648,30 @@ PlacesTreeView.prototype = {
newSort = NHQO.SORT_BY_TAGS_DESCENDING;
else if (allowTriState && oldSort == NHQO.SORT_BY_TAGS_DESCENDING)
newSort = NHQO.SORT_BY_NONE;
else
newSort = NHQO.SORT_BY_TAGS_ASCENDING;
break;
default:
- throw Components.results.NS_ERROR_INVALID_ARG;
+ throw Cr.NS_ERROR_INVALID_ARG;
}
this._result.sortingAnnotation = newSortingAnnotation;
this._result.sortingMode = newSort;
},
isEditable: function PTV_isEditable(aRow, aColumn) {
// At this point we only support editing the title field.
if (aColumn.index != 0)
return false;
let node = this._rows[aRow];
if (!node) {
- Components.utils.reportError("isEditable called for an unbuilt row.");
+ Cu.reportError("isEditable called for an unbuilt row.");
return false;
}
let itemId = node.itemId;
// Only bookmark-nodes are editable. Fortunately, this checks also takes
// care of livemark children.
if (itemId == -1)
return false;
--- a/suite/common/pref/pref-advanced.js
+++ b/suite/common/pref/pref-advanced.js
@@ -13,42 +13,42 @@ function Startup()
/**
* System preferences
*/
function SysPrefCheck()
{
const kPrefService = "@mozilla.org/system-preference-service;1";
let visible = kPrefService in Components.classes &&
- Components.classes[kPrefService].getService() instanceof Components.interfaces.nsIPrefBranch;
+ Cc[kPrefService].getService() instanceof Ci.nsIPrefBranch;
document.getElementById("systemPrefs").hidden = !visible;
}
function ShellServiceCheck()
{
const NS_SHELLSERVICE_CID = "@mozilla.org/suite/shell-service;1";
if (NS_SHELLSERVICE_CID in Components.classes) try {
- Components.classes[NS_SHELLSERVICE_CID]
- .getService(Components.interfaces.nsIShellService)
- .shouldCheckDefaultClient;
+ Cc[NS_SHELLSERVICE_CID]
+ .getService(Ci.nsIShellService)
+ .shouldCheckDefaultClient;
document.getElementById("checkDefault").hidden = false;
} catch (e) {
}
}
function CrashReportsCheck()
{
if ("nsICrashReporter" in Components.interfaces)
{
- var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
- .getService(Components.interfaces.nsICrashReporter);
+ var cr = Cc["@mozilla.org/toolkit/crash-reporter;1"]
+ .getService(Ci.nsICrashReporter);
document.getElementById("crashReports").hidden = !cr.enabled;
document.getElementById("submitCrashes").checked = cr.submitReports;
}
}
function updateSubmitCrashes(aChecked)
{
- Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
- .getService(Components.interfaces.nsICrashReporter)
- .submitReports = aChecked;
+ Cc["@mozilla.org/toolkit/crash-reporter;1"]
+ .getService(Ci.nsICrashReporter)
+ .submitReports = aChecked;
}
--- a/suite/common/pref/pref-appearance.js
+++ b/suite/common/pref/pref-appearance.js
@@ -15,18 +15,18 @@ function Startup()
/**
* From locale switcher's switch.js:
* Load available locales into selection menu
*/
function SwitchLocales_Load() {
var menulist = document.getElementById("switchLocales");
var pref = document.getElementById("general.useragent.locale");
- var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
- .getService(Components.interfaces.nsIToolkitChromeRegistry);
+ var cr = Cc["@mozilla.org/chrome/chrome-registry;1"]
+ .getService(Ci.nsIToolkitChromeRegistry);
var langNames = document.getElementById("languageNamesBundle");
var regNames = document.getElementById("regionNamesBundle");
var locales = cr.getLocalesForPackage("global");
while (locales.hasMore()) {
var locale = locales.getNext();
@@ -87,18 +87,18 @@ function SelectLocale(aElement)
/**
* When starting up, determine application and regional locale settings
* and add the respective strings to the prefpane labels.
*/
function NumberLocales_Load()
{
const osprefs =
- Components.classes["@mozilla.org/intl/ospreferences;1"]
- .getService(Components.interfaces.mozIOSPreferences);
+ Cc["@mozilla.org/intl/ospreferences;1"]
+ .getService(Ci.mozIOSPreferences);
let appLocale = Services.locale.getAppLocalesAsBCP47()[0];
let rsLocale = osprefs.getRegionalPrefsLocales()[0];
let spellChecker = new InlineSpellChecker();
appLocale = spellChecker.getDictionaryDisplayName(appLocale);
rsLocale = spellChecker.getDictionaryDisplayName(rsLocale);
let appLocaleRadio = document.getElementById("appLocale");
--- a/suite/common/pref/pref-applications.js
+++ b/suite/common/pref/pref-applications.js
@@ -8,38 +8,38 @@ function Startup()
{
gApplicationsPane.init();
}
//****************************************************************************//
// Constants & Enumeration Values
// constants for interfaces we need multiple times
-const nsIHandlerApp = Components.interfaces.nsIHandlerApp;
-const nsIHandlerInfo = Components.interfaces.nsIHandlerInfo;
-const nsILocalHandlerApp = Components.interfaces.nsILocalHandlerApp;
-const nsIWebHandlerApp = Components.interfaces.nsIWebHandlerApp;
-const nsIWebContentHandlerInfo = Components.interfaces.nsIWebContentHandlerInfo;
-const nsIFilePicker = Components.interfaces.nsIFilePicker;
-const nsIMIMEInfo = Components.interfaces.nsIMIMEInfo;
-const nsIPropertyBag = Components.interfaces.nsIPropertyBag;
+const nsIHandlerApp = Ci.nsIHandlerApp;
+const nsIHandlerInfo = Ci.nsIHandlerInfo;
+const nsILocalHandlerApp = Ci.nsILocalHandlerApp;
+const nsIWebHandlerApp = Ci.nsIWebHandlerApp;
+const nsIWebContentHandlerInfo = Ci.nsIWebContentHandlerInfo;
+const nsIFilePicker = Ci.nsIFilePicker;
+const nsIMIMEInfo = Ci.nsIMIMEInfo;
+const nsIPropertyBag = Ci.nsIPropertyBag;
// global services
-var handlerSvc = Components.classes["@mozilla.org/uriloader/handler-service;1"]
- .getService(Components.interfaces.nsIHandlerService);
-var categoryMgr = Components.classes["@mozilla.org/categorymanager;1"]
- .getService(Components.interfaces.nsICategoryManager);
-var mimeSvc = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService);
-var converterSvc = Components.classes["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
- .getService(Components.interfaces.nsIWebContentConverterService);
+var handlerSvc = Cc["@mozilla.org/uriloader/handler-service;1"]
+ .getService(Ci.nsIHandlerService);
+var categoryMgr = Cc["@mozilla.org/categorymanager;1"]
+ .getService(Ci.nsICategoryManager);
+var mimeSvc = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService);
+var converterSvc = Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
+ .getService(Ci.nsIWebContentConverterService);
var shellSvc = null;
if ("@mozilla.org/suite/shell-service;1" in Components.classes)
- shellSvc = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(Components.interfaces.nsIShellService);
+ shellSvc = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(Ci.nsIShellService);
const TYPE_MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
const TYPE_MAYBE_VIDEO_FEED = "application/vnd.mozilla.maybe.video.feed";
const TYPE_MAYBE_AUDIO_FEED = "application/vnd.mozilla.maybe.audio.feed";
const PREF_DISABLED_PLUGIN_TYPES = "plugin.disable_full_page_plugin_for_types";
// Preferences that affect which entries to show in the list.
@@ -93,33 +93,33 @@ const kActionUsePlugin = -3;
const kActionChooseApp = -2;
const kActionManageApp = -1;
//****************************************************************************//
// Utilities
function getFileDisplayName(aFile) {
if ("nsILocalFileWin" in Components.interfaces &&
- aFile instanceof Components.interfaces.nsILocalFileWin) {
+ aFile instanceof Ci.nsILocalFileWin) {
try {
return aFile.getVersionInfoField("FileDescription");
} catch (e) {}
}
else if ("nsILocalFileMac" in Components.interfaces &&
- aFile instanceof Components.interfaces.nsILocalFileMac) {
+ aFile instanceof Ci.nsILocalFileMac) {
try {
return aFile.bundleDisplayName;
} catch (e) {}
}
return aFile.leafName;
}
function getLocalHandlerApp(aFile) {
- var localHandlerApp = Components.classes["@mozilla.org/uriloader/local-handler-app;1"]
- .createInstance(nsILocalHandlerApp);
+ var localHandlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"]
+ .createInstance(nsILocalHandlerApp);
localHandlerApp.name = getFileDisplayName(aFile);
localHandlerApp.executable = aFile;
return localHandlerApp;
}
/**
* An enumeration of items in a JS array.
@@ -517,22 +517,22 @@ FeedHandlerInfo.prototype = {
// A minimal implementation of nsIMutableArray. It only supports the two
// methods its callers invoke, namely appendElement, nsIArray::enumerate
// and nsIArray::indexOf.
this._possibleApplicationHandlers = {
_inner: [],
_removed: [],
QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIMutableArray) ||
- aIID.equals(Components.interfaces.nsIArray) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIMutableArray) ||
+ aIID.equals(Ci.nsIArray) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
get length() {
return this._inner.length;
},
enumerate: function() {
return new ArrayEnumerator(this._inner);
@@ -589,18 +589,18 @@ FeedHandlerInfo.prototype = {
try {
defaultFeedReader = shellSvc.defaultFeedReader;
}
catch(ex) {
// no default reader
}
if (defaultFeedReader) {
- let handlerApp = Components.classes["@mozilla.org/uriloader/local-handler-app;1"]
- .createInstance(nsIHandlerApp);
+ let handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"]
+ .createInstance(nsIHandlerApp);
handlerApp.name = getFileDisplayName(defaultFeedReader);
handlerApp.QueryInterface(nsILocalHandlerApp);
handlerApp.executable = defaultFeedReader;
this.__defaultApplicationHandler = handlerApp;
}
else {
this.__defaultApplicationHandler = null;
@@ -888,22 +888,22 @@ var gApplicationsPane = {
Services.prefs.removeObserver(PREF_AUDIO_FEED_SELECTED_ACTION, this);
},
//**************************************************************************//
// nsISupports
QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIObserver) ||
- aIID.equals(Components.interfaces.nsIDOMEventListener ||
- aIID.equals(Components.interfaces.nsISupports)))
+ if (aIID.equals(Ci.nsIObserver) ||
+ aIID.equals(Ci.nsIDOMEventListener ||
+ aIID.equals(Ci.nsISupports)))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
//**************************************************************************//
// nsIObserver
observe: function (aSubject, aTopic, aData) {
// Rebuild the list when there are changes to preferences that influence
@@ -1002,18 +1002,18 @@ var gApplicationsPane = {
* I'll also note that my reading of nsPluginTag::RegisterWithCategoryManager
* suggests that enabledPlugin is only determined during registration
* and does not get updated when plugin.disable_full_page_plugin_for_types
* changes (unless modification of that preference spawns reregistration).
* So even if we could use enabledPlugin to get the plugin that would be used,
* we'd still need to check the pref ourselves to find out if it's enabled.
*/
_loadPluginHandlers: function() {
- let pluginHost = Components.classes["@mozilla.org/plugin/host;1"]
- .getService(Components.interfaces.nsIPluginHost);
+ let pluginHost = Cc["@mozilla.org/plugin/host;1"]
+ .getService(Ci.nsIPluginHost);
for (let pluginTag of pluginHost.getPluginTags()) {
for (let type of pluginTag.getMimeTypes()) {
let handlerInfoWrapper;
if (type in this._handledTypes)
handlerInfoWrapper = this._handledTypes[type];
else {
let wrappedHandlerInfo =
mimeSvc.getFromTypeAndExtension(type, null);
@@ -1239,17 +1239,17 @@ var gApplicationsPane = {
if (aHandlerApp instanceof nsIWebContentHandlerInfo)
return aHandlerApp.uri;
return false;
},
_isValidHandlerExecutable: function(aExecutable) {
var file = Services.dirsvc.get("XREExeF",
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
return aExecutable &&
aExecutable.exists() &&
aExecutable.isExecutable() &&
aExecutable.leafName != file.leafName;
},
/**
* Rebuild the actions menu for the selected entry. Gets called by
@@ -1595,28 +1595,28 @@ var gApplicationsPane = {
if (this.isValidHandlerApp(params.handlerApp)) {
handlerApp = params.handlerApp;
// Add the app to the type's list of possible handlers.
handlerInfo.addPossibleApplicationHandler(handlerApp);
}
#else
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
var winTitle = this._prefsBundle.getString("fpTitleChooseApp");
fp.init(window, winTitle, nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterApps);
// Prompt the user to pick an app. If they pick one, and it's a valid
// selection, then add it to the list of possible handlers.
if (fp.show() == nsIFilePicker.returnOK && fp.file &&
this._isValidHandlerExecutable(fp.file)) {
- handlerApp = Components.classes["@mozilla.org/uriloader/local-handler-app;1"]
- .createInstance(nsILocalHandlerApp);
+ handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"]
+ .createInstance(nsILocalHandlerApp);
handlerApp.name = getFileDisplayName(fp.file);
handlerApp.executable = fp.file;
// Add the app to the type's list of possible handlers.
let handlerInfo = this._handledTypes[this._list.selectedItem.type];
handlerInfo.addPossibleApplicationHandler(handlerApp);
}
#endif
@@ -1705,17 +1705,17 @@ var gApplicationsPane = {
}
// We know nothing about other kinds of handler apps.
return "";
},
_getIconURLForFile: function(aFile) {
var fph = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
var urlSpec = fph.getURLSpecFromFile(aFile);
return "moz-icon://" + urlSpec + "?size=16";
},
_getIconURLForWebApp: function(aWebAppURITemplate) {
var uri = Services.io.newURI(aWebAppURITemplate);
--- a/suite/common/pref/pref-cache.js
+++ b/suite/common/pref/pref-cache.js
@@ -20,18 +20,18 @@ var CacheObserver = {
var prefStrBundle = document.getElementById("bundle_prefutilities");
var sizeStr = prefStrBundle.getFormattedString("cacheSizeInfo",
sizeStrings);
actualSizeLabel.textContent = sizeStr;
},
/* nsISupports */
QueryInterface: XPCOMUtils.generateQI(
- [Components.interfaces.nsICacheStorageConsumptionObserver,
- Components.interfaces.nsISupportsWeakReference])
+ [Ci.nsICacheStorageConsumptionObserver,
+ Ci.nsISupportsWeakReference])
};
// because the cache is in kilobytes, and the UI is in megabytes.
function ReadCacheDiskCapacity()
{
var pref = document.getElementById("browser.cache.disk.capacity");
return pref.value >> 10;
}
@@ -62,33 +62,33 @@ function ReadCacheFolder(aField)
aField.file = file;
aField.label = (/Mac/.test(navigator.platform)) ? file.leafName : file.path;
}
}
function CacheSelectFolder()
{
var pref = document.getElementById("browser.cache.disk.parent_directory");
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
var prefutilitiesBundle = document.getElementById("bundle_prefutilities");
var title = prefutilitiesBundle.getString("cachefolder");
fp.init(window, title, nsIFilePicker.modeGetFolder);
fp.displayDirectory = pref.value;
fp.appendFilters(nsIFilePicker.filterAll);
if (fp.show() == nsIFilePicker.returnOK)
pref.value = fp.file;
}
function ClearDiskAndMemCache()
{
- Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
- .getService(Components.interfaces.nsICacheStorageService).clear();
+ Cc["@mozilla.org/netwerk/cache-storage-service;1"]
+ .getService(Ci.nsICacheStorageService).clear();
updateActualCacheSize();
}
function updateCacheSizeUI(cacheSizeEnabled)
{
document.getElementById("browserCacheDiskCacheBefore").disabled = cacheSizeEnabled;
document.getElementById("browserCacheDiskCache").disabled = cacheSizeEnabled;
document.getElementById("browserCacheDiskCacheAfter").disabled = cacheSizeEnabled;
@@ -98,12 +98,12 @@ function ReadSmartSizeEnabled()
{
var enabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
updateCacheSizeUI(enabled);
return enabled;
}
function updateActualCacheSize()
{
- Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
- .getService(Components.interfaces.nsICacheStorageService)
- .asyncGetDiskConsumption(CacheObserver);
+ Cc["@mozilla.org/netwerk/cache-storage-service;1"]
+ .getService(Ci.nsICacheStorageService)
+ .asyncGetDiskConsumption(CacheObserver);
}
--- a/suite/common/pref/pref-download.js
+++ b/suite/common/pref/pref-download.js
@@ -8,17 +8,17 @@ const kDownloads = 1;
const kUserDir = 2;
var gFPHandler;
var gSoundUrlPref;
function Startup()
{
// Define globals
gFPHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
gSoundUrlPref = document.getElementById("browser.download.finished_sound_url");
SetSoundEnabled(document.getElementById("browser.download.finished_download_sound").value);
// if we don't have the alert service, hide the pref UI for using alerts to
// notify on download completion
// see bug #158711
var downloadDoneNotificationAlertUI = document.getElementById("finishedNotificationAlert");
downloadDoneNotificationAlertUI.hidden = !("@mozilla.org/alerts-service;1" in Components.classes);
@@ -39,20 +39,20 @@ function ReadUseDownloadDir()
/**
* Displays a file picker in which the user can choose the location where
* downloads are automatically saved, updating preferences and UI in
* response to the choice, if one is made.
*/
function ChooseFolder()
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
+ const nsIFilePicker = Ci.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
var prefutilitiesBundle = document.getElementById("bundle_prefutilities");
var title = prefutilitiesBundle.getString("downloadfolder");
fp.init(window, title, nsIFilePicker.modeGetFolder);
fp.appendFilters(nsIFilePicker.filterAll);
var folderListPref = document.getElementById("browser.download.folderList");
fp.displayDirectory = IndexToFolder(folderListPref.value); // file
@@ -95,19 +95,19 @@ function DisplayDownloadDirPref()
}
/**
* Returns the Downloads folder as determined by the XPCOM directory service
* via the download manager's attribute defaultDownloadsDirectory.
*/
function GetDownloadsFolder()
{
- return Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager)
- .defaultDownloadsDirectory;
+ return Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager)
+ .defaultDownloadsDirectory;
}
/**
* Determines the type of the given folder.
*
* @param aFolder
* the folder whose type is to be determined
* @returns integer
--- a/suite/common/pref/pref-fonts.js
+++ b/suite/common/pref/pref-fonts.js
@@ -6,18 +6,18 @@
var gAllFonts = null;
var gFontEnumerator = null;
var gDisabled = false;
function GetFontEnumerator()
{
if (!gFontEnumerator)
{
- gFontEnumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
- .createInstance(Components.interfaces.nsIFontEnumerator);
+ gFontEnumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
+ .createInstance(Ci.nsIFontEnumerator);
}
return gFontEnumerator;
}
function BuildFontList(aLanguage, aFontType, aMenuList, aPreference)
{
var defaultFont = null;
// Load Font Lists
--- a/suite/common/pref/pref-history.js
+++ b/suite/common/pref/pref-history.js
@@ -21,18 +21,18 @@ function Startup()
connection.close();
}
}
urlbarHistButton.disabled = isBtnDisabled;
}
catch(ex) {
}
var globalHistButton = document.getElementById("browserClearHistory");
- var globalHistory = Components.classes["@mozilla.org/browser/nav-history-service;1"]
- .getService(Components.interfaces.nsINavHistoryService);
+ var globalHistory = Cc["@mozilla.org/browser/nav-history-service;1"]
+ .getService(Ci.nsINavHistoryService);
if (!globalHistory.hasHistoryEntries)
globalHistButton.disabled = true;
}
function prefClearGlobalHistory()
{
ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
PlacesUtils.history.clear();
--- a/suite/common/pref/pref-languages-add.js
+++ b/suite/common/pref/pref-languages-add.js
@@ -124,18 +124,18 @@ function OnAccept()
{
if (!gInvalidLanguages)
return true;
let prefLangBundle = document.getElementById("prefLangAddBundle");
const kErrorMsg = prefLangBundle.getString("illegalOtherLanguage") + " " +
gInvalidLanguages;
const kErrorTitle = prefLangBundle.getString("illegalOtherLanguageTitle");
- let prompter = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
+ let prompter = Cc["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Ci.nsIPromptService);
prompter.alert(this.window, kErrorTitle, kErrorMsg);
gInvalidLanguages = null;
gOtherLanguages.focus();
return false;
}
function HandleDoubleClick()
--- a/suite/common/pref/pref-languages.js
+++ b/suite/common/pref/pref-languages.js
@@ -31,17 +31,17 @@ function ReadAvailableLanguages()
var regionsBundle = document.getElementById("regionNamesBundle");
var langStrings = document.getElementById("acceptedBundle").strings;
while (langStrings.hasMoreElements())
{
// Progress through the bundle.
var curItem = langStrings.getNext();
- if (!(curItem instanceof Components.interfaces.nsIPropertyElement))
+ if (!(curItem instanceof Ci.nsIPropertyElement))
break;
var stringNameProperty = curItem.key.split('.');
var str = stringNameProperty[0];
if (str && stringNameProperty[1] == 'accept')
{
var stringLangRegion = str.split('-');
--- a/suite/common/pref/pref-links.js
+++ b/suite/common/pref/pref-links.js
@@ -5,11 +5,11 @@
function Startup()
{
ToggleRestrictionGroup(document.getElementById("browser.link.open_newwindow").value);
}
function ToggleRestrictionGroup(value)
{
document.getElementById("restrictionGroup").disabled =
- value == Components.interfaces.nsIBrowserDOMWindow.OPEN_NEWWINDOW ||
+ value == Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW ||
document.getElementById("browser.link.open_newwindow.restriction").locked;
}
--- a/suite/common/pref/pref-navigator.js
+++ b/suite/common/pref/pref-navigator.js
@@ -195,19 +195,19 @@ function UpdateHomePageList(aSingleURL)
{
// write single URL into input box and set it as the list of homepages
SetHomePageValue(aSingleURL);
UpdateHomePageListFromInput();
}
function SelectFile()
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
var prefutilitiesBundle = document.getElementById("bundle_prefutilities");
var title = prefutilitiesBundle.getString("choosehomepage");
fp.init(window, title, nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterAll |
nsIFilePicker.filterText |
nsIFilePicker.filterXML |
nsIFilePicker.filterHTML |
nsIFilePicker.filterImages);
@@ -258,29 +258,29 @@ function WriteConcurrentTabs()
var val = document.getElementById("maxConcurrentTabsGroup").value;
return val > 0 ? document.getElementById("maxConcurrentTabs").value : val;
}
// platform integration
function ApplySetAsDefaultBrowser()
{
- const nsIShellService = Components.interfaces.nsIShellService;
- var shellSvc = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ const nsIShellService = Ci.nsIShellService;
+ var shellSvc = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
shellSvc.setDefaultClient(false, false, nsIShellService.BROWSER);
shellSvc.shouldBeDefaultClientFor |= nsIShellService.BROWSER;
}
function IsDefaultBrowser()
{
- const nsIShellService = Components.interfaces.nsIShellService;
- var shellSvc = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ const nsIShellService = Ci.nsIShellService;
+ var shellSvc = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
return shellSvc.isDefaultClient(false, nsIShellService.BROWSER);
}
function InitPlatformIntegration()
{
const NS_SHELLSERVICE_CID = "@mozilla.org/suite/shell-service;1";
--- a/suite/common/pref/pref-offlineapps.js
+++ b/suite/common/pref/pref-offlineapps.js
@@ -88,18 +88,18 @@ function UpdateNotifyBox(aValue)
EnableElementById("offlineNotifyAsk", !aValue);
// remove this once bug 934457 and bug 1024832 are fixed
document.getElementById("offlineNotifyPermissions").disabled = aValue;
}
function _getOfflineAppUsage(aPermission)
{
- var appCache = Components.classes["@mozilla.org/network/application-cache-service;1"]
- .getService(Components.interfaces.nsIApplicationCacheService);
+ var appCache = Cc["@mozilla.org/network/application-cache-service;1"]
+ .getService(Ci.nsIApplicationCacheService);
var groups = appCache.getGroups();
var usage = 0;
for (let i = 0; i < groups.length; i++) {
let uri = Services.io.newURI(groups[i]);
if (aPermission.matchesURI(uri, true))
usage += appCache.getActiveCache(groups[i]).usage;
}
@@ -116,17 +116,17 @@ function UpdateOfflineApps()
list.lastChild.remove();
var bundle = document.getElementById("bundle_prefutilities");
var pm = Services.perms;
var enumerator = pm.enumerator;
while (enumerator.hasMoreElements()) {
let perm = enumerator.getNext()
- .QueryInterface(Components.interfaces.nsIPermission);
+ .QueryInterface(Ci.nsIPermission);
if (perm.type != "offline-app" ||
perm.capability != pm.ALLOW_ACTION)
continue;
let usage = _getOfflineAppUsage(perm);
let row = document.createElement("listitem");
row.setAttribute("host", perm.principal.URI.host);
let converted = DownloadUtils.convertByteUnits(usage);
@@ -155,18 +155,18 @@ function RemoveOfflineApp()
var title = bundle.getString("offlineAppRemoveTitle");
var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [host]);
var confirm = bundle.getString("offlineAppRemoveConfirm");
if (Services.prompt.confirmEx(window, title, prompt, flags, confirm,
null, null, null, {}))
return;
// clear offline cache entries
- var appCache = Components.classes["@mozilla.org/network/application-cache-service;1"]
- .getService(Components.interfaces.nsIApplicationCacheService);
+ var appCache = Cc["@mozilla.org/network/application-cache-service;1"]
+ .getService(Ci.nsIApplicationCacheService);
var groups = appCache.getGroups();
for (let i = 0; i < groups.length; i++) {
var uri = Services.io.newURI(groups[i]);
if (uri.asciiHost == host)
appCache.getActiveCache(groups[i]).discard();
}
// remove the permission
--- a/suite/common/pref/pref-popups.js
+++ b/suite/common/pref/pref-popups.js
@@ -12,21 +12,21 @@ function Startup()
SetButtons();
}
function SetLists()
{
const kPopupType = "popup";
- const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
- const nsIPermission = Components.interfaces.nsIPermission;
+ const nsIPermissionManager = Ci.nsIPermissionManager;
+ const nsIPermission = Ci.nsIPermission;
- var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(nsIPermissionManager);
+ var permissionManager = Cc["@mozilla.org/permissionmanager;1"]
+ .getService(nsIPermissionManager);
var pref = document.getElementById("privacy.popups.remove_blacklist");
if (pref.value)
{
var enumerator = permissionManager.enumerator;
var uris = [];
while (enumerator.hasMoreElements())
--- a/suite/common/pref/pref-privatedata.js
+++ b/suite/common/pref/pref-privatedata.js
@@ -29,12 +29,12 @@ function updateClearNowButtonLabel()
/**
* Either displays a dialog from which individual parts of private data may be
* cleared, or automatically clears private data according to current
* CPD settings. The former happens if privacy.sanitize.promptOnSanitize is
* true, and the latter happens otherwise.
*/
function clearPrivateDataNow()
{
- Components.classes["@mozilla.org/suite/suiteglue;1"]
- .getService(Components.interfaces.nsISuiteGlue)
- .sanitize(window);
+ Cc["@mozilla.org/suite/suiteglue;1"]
+ .getService(Ci.nsISuiteGlue)
+ .sanitize(window);
}
--- a/suite/common/pref/pref-proxies.js
+++ b/suite/common/pref/pref-proxies.js
@@ -123,25 +123,25 @@ function EnableUnlockedButton(aElement)
(aElement.valueFromPreferences == aElement.value);
EnableElementById("autoReload", enable, false);
}
function ReloadPAC() {
// This reloads the PAC URL stored in preferences.
// When not in instant apply mode, the button that calls this gets
// disabled if the preference and what is showing in the UI differ.
- Components.classes["@mozilla.org/network/protocol-proxy-service;1"]
- .getService().reloadPAC();
+ Cc["@mozilla.org/network/protocol-proxy-service;1"]
+ .getService().reloadPAC();
}
function FixProxyURL(aURL)
{
- const nsIURIFixup = Components.interfaces.nsIURIFixup;
- var URIFixup = Components.classes["@mozilla.org/docshell/urifixup;1"]
- .getService(nsIURIFixup);
+ const nsIURIFixup = Ci.nsIURIFixup;
+ var URIFixup = Cc["@mozilla.org/docshell/urifixup;1"]
+ .getService(nsIURIFixup);
try
{
aURL.value = URIFixup.createFixupURI(aURL.value,
nsIURIFixup.FIXUP_FLAG_NONE).spec;
}
catch (e) {}
if (!gInstantApply)
--- a/suite/common/pref/pref-smartupdate.js
+++ b/suite/common/pref/pref-smartupdate.js
@@ -6,18 +6,18 @@
var gCanCheckForUpdates;
function Startup()
{
var hasUpdater = "nsIApplicationUpdateService" in Components.interfaces;
if (hasUpdater)
{
- var aus = Components.classes["@mozilla.org/updates/update-service;1"]
- .getService(Components.interfaces.nsIApplicationUpdateService);
+ var aus = Cc["@mozilla.org/updates/update-service;1"]
+ .getService(Ci.nsIApplicationUpdateService);
gCanCheckForUpdates = aus.canCheckForUpdates;
UpdateAddonsItems();
UpdateAppItems();
}
else
{
var appGroupBox = document.getElementById("appUpdatesGroupBox");
@@ -76,12 +76,12 @@ function UpdateAppItems()
!enabledPref.value || !gCanCheckForUpdates;
}
/**
* Displays the history of installed updates.
*/
function ShowUpdateHistory()
{
- Components.classes["@mozilla.org/updates/update-prompt;1"]
- .createInstance(Components.interfaces.nsIUpdatePrompt)
- .showUpdateHistory(window);
+ Cc["@mozilla.org/updates/update-prompt;1"]
+ .createInstance(Ci.nsIUpdatePrompt)
+ .showUpdateHistory(window);
}
--- a/suite/common/pref/pref-spelling.js
+++ b/suite/common/pref/pref-spelling.js
@@ -13,18 +13,18 @@ function Startup() {
{
document.getElementById("generalSpelling").hidden = true;
document.getElementById("mailSpelling").hidden = true;
document.getElementById("noSpellCheckLabel").hidden = false;
}
}
function InitLanguageMenu() {
- var spellChecker = Components.classes["@mozilla.org/spellchecker/engine;1"]
- .getService(Components.interfaces.mozISpellCheckingEngine);
+ var spellChecker = Cc["@mozilla.org/spellchecker/engine;1"]
+ .getService(Ci.mozISpellCheckingEngine);
var o1 = {};
var o2 = {};
// Get the list of dictionaries from the spellchecker.
spellChecker.getDictionaryList(o1, o2);
var dictList = o1.value;
--- a/suite/common/pref/pref-sync.js
+++ b/suite/common/pref/pref-sync.js
@@ -36,18 +36,18 @@ var gSyncPane = {
"weave:service:logout:finish"],
init: function () {
for (var topic of this.topics)
Services.obs.addObserver(this, topic);
window.addEventListener("unload", this);
- var xps = Components.classes["@mozilla.org/weave/service;1"]
- .getService().wrappedJSObject;
+ var xps = Cc["@mozilla.org/weave/service;1"]
+ .getService().wrappedJSObject;
if (xps.ready)
this.observe(null, "weave:service:ready", null);
else
xps.ensureLoaded();
},
handleEvent: function (aEvent) {
window.removeEventListener("unload", this);
--- a/suite/common/pref/preferences.js
+++ b/suite/common/pref/preferences.js
@@ -51,19 +51,19 @@ function WriteSoundField(aField, aValue)
{
aField.file = file;
aField.label = (/Mac/.test(navigator.platform)) ? file.leafName : file.path;
}
}
function SelectSound(aSoundUrlPref)
{
- const nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(nsIFilePicker);
+ const nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(nsIFilePicker);
var prefutilitiesBundle = document.getElementById("bundle_prefutilities");
fp.init(window, prefutilitiesBundle.getString("choosesound"),
nsIFilePicker.modeOpen);
var file = GetFileFromString(aSoundUrlPref.value);
if (file && file.parent && file.parent.exists())
fp.displayDirectory = file.parent;
@@ -75,19 +75,19 @@ function SelectSound(aSoundUrlPref)
fp.appendFilters(nsIFilePicker.filterAll);
if (fp.show() == nsIFilePicker.returnOK)
aSoundUrlPref.value = fp.fileURL.spec;
}
function PlaySound(aValue, aMail)
{
- const nsISound = Components.interfaces.nsISound;
- var sound = Components.classes["@mozilla.org/sound;1"]
- .createInstance(nsISound);
+ const nsISound = Ci.nsISound;
+ var sound = Cc["@mozilla.org/sound;1"]
+ .createInstance(nsISound);
if (aValue)
sound.play(Services.io.newURI(aValue));
else if (aMail && !/Mac/.test(navigator.platform))
sound.playEventSound(nsISound.EVENT_NEW_MAIL_RECEIVED);
else
sound.beep();
}
--- a/suite/common/profile/profileSelection.js
+++ b/suite/common/profile/profileSelection.js
@@ -4,48 +4,48 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
var gProfileBundle;
var gBrandBundle;
var gProfileService;
-var gPromptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
+var gPromptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Ci.nsIPromptService);
var gProfileManagerMode = "selection";
var gDialogParams = window.arguments[0]
- .QueryInterface(Components.interfaces.nsIDialogParamBlock);
+ .QueryInterface(Ci.nsIDialogParamBlock);
function StartUp()
{
gProfileBundle = document.getElementById("bundle_profile");
gBrandBundle = document.getElementById("bundle_brand");
if (gDialogParams.objects) {
document.documentElement.getButton("accept").setAttribute("label",
document.documentElement.getAttribute("buttonlabelstart"));
document.documentElement.getButton("cancel").setAttribute("label",
document.documentElement.getAttribute("buttonlabelexit"));
document.getElementById('intro').textContent =
document.getElementById('intro').getAttribute("start");
document.getElementById('offlineState').hidden = false;
gDialogParams.SetInt(0, 0);
}
- gProfileService = Components.classes["@mozilla.org/toolkit/profile-service;1"]
- .getService(Components.interfaces.nsIToolkitProfileService);
+ gProfileService = Cc["@mozilla.org/toolkit/profile-service;1"]
+ .getService(Ci.nsIToolkitProfileService);
var profileEnum = gProfileService.profiles;
var selectedProfile = null;
try {
selectedProfile = gProfileService.selectedProfile;
}
catch (ex) {
}
while (profileEnum.hasMoreElements()) {
- AddItem(profileEnum.getNext().QueryInterface(Components.interfaces.nsIToolkitProfile),
+ AddItem(profileEnum.getNext().QueryInterface(Ci.nsIToolkitProfile),
selectedProfile);
}
var autoSelect = document.getElementById("autoSelect");
if (Services.prefs.getBoolPref("profile.manage_only_at_launch"))
autoSelect.hidden = true;
else
autoSelect.checked = gProfileService.startWithLastProfile;
@@ -87,20 +87,20 @@ function AcceptDialog()
gProfileService.startWithLastProfile = autoSelect.checked;
gProfileService.flush();
}
var profileTree = document.getElementById("profiles");
var selected = profileTree.view.getItemAtIndex(profileTree.currentIndex);
if (!gDialogParams.objects) {
- var dirServ = Components.classes['@mozilla.org/file/directory_service;1']
- .getService(Components.interfaces.nsIProperties);
- var profD = dirServ.get("ProfD", Components.interfaces.nsIFile);
- var profLD = dirServ.get("ProfLD", Components.interfaces.nsIFile);
+ var dirServ = Cc['@mozilla.org/file/directory_service;1']
+ .getService(Ci.nsIProperties);
+ var profD = dirServ.get("ProfD", Ci.nsIFile);
+ var profLD = dirServ.get("ProfLD", Ci.nsIFile);
if (selected.profile.rootDir.equals(profD) &&
selected.profile.localDir.equals(profLD))
return true;
}
try {
var profileLock = selected.profile.lock({});
@@ -120,32 +120,32 @@ function AcceptDialog()
var message = gProfileBundle.getFormattedString("dirLocked",
[brandName, selected.profile.name]);
gPromptService.alert(window, null, message);
return false;
}
// Although switching profile works by performing a restart internally,
// the user is quitting the old profile, so make it look like a quit.
- var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService)
- .notifyObservers(cancelQuit, "quit-application-requested");
+ var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
+ .createInstance(Ci.nsISupportsPRBool);
+ Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService)
+ .notifyObservers(cancelQuit, "quit-application-requested");
if (cancelQuit.data)
return false;
try {
- var env = Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment);
+ var env = Cc["@mozilla.org/process/environment;1"]
+ .getService(Ci.nsIEnvironment);
env.set("XRE_PROFILE_NAME", selected.profile.name);
env.set("XRE_PROFILE_PATH", selected.profile.rootDir.path);
env.set("XRE_PROFILE_LOCAL_PATH", selected.profile.localDir.path);
- var app = Components.classes["@mozilla.org/toolkit/app-startup;1"]
- .getService(Components.interfaces.nsIAppStartup);
+ var app = Cc["@mozilla.org/toolkit/app-startup;1"]
+ .getService(Ci.nsIAppStartup);
app.quit(app.eAttemptQuit | app.eRestart);
return true;
}
catch (e) {
env.set("XRE_PROFILE_NAME", "");
env.set("XRE_PROFILE_PATH", "");
env.set("XRE_PROFILE_LOCAL_PATH", "");
return false;
--- a/suite/common/safeMode.js
+++ b/suite/common/safeMode.js
@@ -1,48 +1,48 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
function restartApp() {
- var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"]
- .getService(Components.interfaces.nsIAppStartup);
+ var appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
+ .getService(Ci.nsIAppStartup);
appStartup.quit(appStartup.eForceQuit | appStartup.eRestart);
}
function clearAllPrefs() {
Services.prefs.resetUserPrefs();
// Remove the pref-overrides dir, if it exists.
try {
- var fileLocator = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties);
+ var fileLocator = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties);
const NS_APP_PREFS_OVERRIDE_DIR = "PrefDOverride";
var prefOverridesDir = fileLocator.get(NS_APP_PREFS_OVERRIDE_DIR,
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
prefOverridesDir.remove(true);
} catch (ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
}
function restoreDefaultBookmarks() {
Services.prefs.setBoolPref("browser.bookmarks.restore_default_bookmarks", true);
}
function deleteLocalstore() {
const nsIDirectoryServiceContractID = "@mozilla.org/file/directory_service;1";
- const nsIProperties = Components.interfaces.nsIProperties;
- var directoryService = Components.classes[nsIDirectoryServiceContractID]
- .getService(nsIProperties);
+ const nsIProperties = Ci.nsIProperties;
+ var directoryService = Cc[nsIDirectoryServiceContractID]
+ .getService(nsIProperties);
// Delete the old localstore otherwise it will get imported.
- var localstoreFile = directoryService.get("LStoreS", Components.interfaces.nsIFile);
+ var localstoreFile = directoryService.get("LStoreS", Ci.nsIFile);
if (localstoreFile.exists())
localstoreFile.remove(false);
// Delete the new xulstore file.
localstoreFile.leafName = "xulstore.json";
if (localstoreFile.exists())
localstoreFile.remove(false);
}
@@ -62,18 +62,18 @@ function disableAddons() {
}
});
restartApp();
});
}
function restoreDefaultSearchEngines() {
- var searchService = Components.classes["@mozilla.org/browser/search-service;1"]
- .getService(Components.interfaces.nsIBrowserSearchService);
+ var searchService = Cc["@mozilla.org/browser/search-service;1"]
+ .getService(Ci.nsIBrowserSearchService);
searchService.restoreDefaultEngines();
}
function onOK() {
try {
if (document.getElementById("resetUserPrefs").checked)
clearAllPrefs();
if (document.getElementById("deleteBookmarks").checked)
@@ -90,18 +90,18 @@ function onOK() {
} catch(e) {
}
restartApp();
return false;
}
function onCancel() {
- var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"]
- .getService(Components.interfaces.nsIAppStartup);
+ var appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
+ .getService(Ci.nsIAppStartup);
appStartup.quit(appStartup.eForceQuit);
return false;
}
function onLoad() {
document.documentElement.getButton("extra1").focus();
}
--- a/suite/common/search/search-panel.js
+++ b/suite/common/search/search-panel.js
@@ -58,29 +58,29 @@ function doSearch() {
if (textValue && !isPB) {
FormHistory.update({
op: "bump",
fieldname: "searchbar-history",
value: textValue
}, {
handleError: function(aError) {
- Components.utils.reportError("Saving search to form history failed: " + aError.message);
+ Cu.reportError("Saving search to form history failed: " + aError.message);
}
});
}
var where = Services.prefs.getBoolPref("browser.search.openintab") ? "tab" : "current";
var submission = Services.search.currentEngine.getSubmission(textValue);
openUILinkIn(submission.uri.spec, where, null, submission.postData);
}
var engineObserver = {
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
- Components.interfaces.nsISupportsWeakReference]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
+ Ci.nsISupportsWeakReference]),
observe: function(aEngine, aTopic, aVerb) {
if (aTopic == SEARCH_ENGINE_TOPIC) {
// Right now, always just rebuild the list after any modification.
LoadEngineList();
}
}
}
--- a/suite/common/search/search.xml
+++ b/suite/common/search/search.xml
@@ -74,26 +74,26 @@
<constructor><![CDATA[
if (this.parentNode.parentNode.localName == "toolbarpaletteitem")
return;
if (this.usePrivateBrowsing)
this._textbox.searchParam += "|private";
this.searchService.init(this);
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.addObserver(this, "browser-search-engine-modified");
this._addedObserver = true;
]]></constructor>
<destructor><![CDATA[
if (this._addedObserver) {
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.removeObserver(this, "browser-search-engine-modified");
this._addedObserver = false;
}
// Make sure to break the cycle from _textbox to us. Otherwise we leak
// the world. But make sure it's actually pointing to us.
if (this._textbox.mController.input == this)
this._textbox.mController.input = null;
@@ -127,18 +127,18 @@
this._engines = this.searchService.getVisibleEngines();
return this._engines;
]]></getter>
</property>
<property name="currentEngine">
<setter><![CDATA[
this.searchService.currentEngine = val;
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.notifyObservers(null, "browser-search-engine-modified", "engine-current");
return val;
]]></setter>
<getter><![CDATA[
var currentEngine = this.searchService.currentEngine;
// Return a dummy engine if there is no currentEngine
return currentEngine || {name: "", uri: null};
]]></getter>
@@ -169,17 +169,17 @@
<method name="onInitComplete">
<parameter name="aStatus"/>
<body><![CDATA[
if (Components.isSuccessCode(aStatus)) {
// Refresh the display (updating icon, etc)
this.updateDisplay();
} else {
- Components.utils.reportError("Cannot initialize search service, bailing out: " + aStatus);
+ Cu.reportError("Cannot initialize search service, bailing out: " + aStatus);
}
]]></body>
</method>
<method name="onSuccess">
<parameter name="aEngine"/>
<body><![CDATA[
this.currentEngine = aEngine;
@@ -462,17 +462,17 @@
// Save the current value in the form history.
if (aData && !this.usePrivateBrowsing) {
this._textbox.FormHistory.update({
op : "bump",
fieldname : "searchbar-history",
value : aData
}, {
handleError : function(aError) {
- Components.utils.reportError("Saving search to form history failed: " + aError.message);
+ Cu.reportError("Saving search to form history failed: " + aError.message);
}
});
}
// null parameter below specifies HTML response for search
var submission = this.currentEngine.getSubmission(aData);
openUILinkIn(submission.uri.spec, aWhere, null, submission.postData);
]]></body>
@@ -481,17 +481,17 @@
<handlers>
<handler event="command"><![CDATA[
const target = event.originalTarget;
if (target.engine) {
this.currentEngine = target.engine;
} else if (target.classList.contains("addengine-item")) {
// We only detect OpenSearch files
- var type = Components.interfaces.nsISearchEngine.DATA_XML;
+ var type = Ci.nsISearchEngine.DATA_XML;
// Select the installed engine if the installation succeeds
this.searchService.addEngine(target.getAttribute("uri"), type,
target.getAttribute("image"), false,
this);
}
else
return;
--- a/suite/common/setDesktopBackground.js
+++ b/suite/common/setDesktopBackground.js
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-const nsIShellService = Components.interfaces.nsIShellService;
-var gShell = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+const nsIShellService = Ci.nsIShellService;
+var gShell = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
var gImage, gPosition, gPicker, gDesktop;
function onLoad()
{
document.getElementById("itemsBox").hidden = /Mac/.test(navigator.platform);
gImage = window.arguments[0];
gPosition = document.getElementById("position");
--- a/suite/common/sidebar/customize-panel.js
+++ b/suite/common/sidebar/customize-panel.js
@@ -1,16 +1,16 @@
/* -*- Mode: Java -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// the rdf service
-var RDF = Components.classes["@mozilla.org/rdf/rdf-service;"]
- .getService(Components.interfaces.nsIRDFService);
+var RDF = Cc["@mozilla.org/rdf/rdf-service;"]
+ .getService(Ci.nsIRDFService);
var NC = "http://home.netscape.com/NC-rdf#";
var sidebarObj = new Object;
var customizeObj = new Object;
function Init()
{
--- a/suite/common/sidebar/customize.js
+++ b/suite/common/sidebar/customize.js
@@ -12,18 +12,18 @@ ChromeUtils.import("resource://gre/modul
//////////////////////////////////////////////////////////////
// Global variables
//////////////////////////////////////////////////////////////
// Set to true for noise
const CUST_DEBUG = false;
// the rdf service
-var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
- .getService(Components.interfaces.nsIRDFService);
+var RDF = Cc["@mozilla.org/rdf/rdf-service;1"]
+ .getService(Ci.nsIRDFService);
var NC = "http://home.netscape.com/NC-rdf#";
var sidebarObj = new Object;
var allPanelsObj = new Object;
var original_panels = new Array();
//////////////////////////////////////////////////////////////
// Sidebar Init/Destroy
@@ -63,36 +63,36 @@ function sidebar_customize_init()
// Root the customize dialog at the correct place.
debug("Init: reset all panels ref, "+allPanelsObj.resource);
all_panels.setAttribute('ref', allPanelsObj.resource);
// Create a "container" wrapper around the current panels to
// manipulate the RDF:Seq more easily.
var panel_list = sidebarObj.datasource.GetTarget(RDF.GetResource(sidebarObj.resource), RDF.GetResource(NC + "panel-list"), true);
- sidebarObj.container = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);
+ sidebarObj.container = Cc["@mozilla.org/rdf/container;1"].createInstance(Ci.nsIRDFContainer);
sidebarObj.container.Init(sidebarObj.datasource, panel_list);
// Add all the current panels to the tree
current_panels = sidebarObj.container.GetElements();
while (current_panels.hasMoreElements()) {
- var panel = current_panels.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+ var panel = current_panels.getNext().QueryInterface(Ci.nsIRDFResource);
if (add_node_to_current_list(sidebarObj.datasource, panel) >= 0) {
original_panels.push(panel.Value);
original_panels[panel.Value] = true;
}
}
var links =
all_panels.database.GetSources(RDF.GetResource(NC + "haslink"),
RDF.GetLiteral("true"), true);
while (links.hasMoreElements()) {
var folder =
- links.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+ links.getNext().QueryInterface(Ci.nsIRDFResource);
var folder_name = folder.Value;
debug("+++ fixing up remote container " + folder_name + "\n");
fixup_remote_container(folder_name);
}
sizeToContent();
}
@@ -159,17 +159,17 @@ function fixup_children(id) {
}
function get_attr(registry,service,attr_name)
{
var attr = registry.GetTarget(service,
RDF.GetResource(NC + attr_name),
true);
if (attr)
- attr = attr.QueryInterface(Components.interfaces.nsIRDFLiteral);
+ attr = attr.QueryInterface(Ci.nsIRDFLiteral);
if (attr)
attr = attr.Value;
return attr;
}
function SelectChangeForOtherPanels(event, target)
{
enable_buttons_for_other_panels();
@@ -215,18 +215,18 @@ function ClickOnOtherPanels(event)
}
function add_datasource_to_other_panels(link) {
// Convert the |link| attribute into a URL
var url = document.location;
debug("Current URL: " +url);
debug("Current link: " +link);
- var uri = Components.classes['@mozilla.org/network/standard-url;1'].createInstance();
- uri = uri.QueryInterface(Components.interfaces.nsIURI);
+ var uri = Cc['@mozilla.org/network/standard-url;1'].createInstance();
+ uri = uri.QueryInterface(Ci.nsIURI);
uri.spec = url;
uri = uri.resolve(link);
debug("New URL: " +uri);
// Add the datasource to the tree
var all_panels = document.getElementById('other-panels');
all_panels.database.AddDataSource(RDF.GetDataSource(uri));
@@ -465,23 +465,23 @@ function Save()
list_unchanged = false;
}
if (list_unchanged)
return;
// Remove all the current panels from the datasource.
current_panels = sidebarObj.container.GetElements();
while (current_panels.hasMoreElements()) {
- panel = current_panels.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
+ panel = current_panels.getNext().QueryInterface(Ci.nsIRDFResource);
// "Check if the item is one of the broadcaster panels imported to RDF from
// mainBroadcasterSet. If so, then don't remove it from datasource.
var master_list = sidebarObj.datasource.GetTarget(RDF.GetResource(allPanelsObj.resource), RDF.GetResource(NC + "panel-list"), true);
- var masterSeq = Components.classes["@mozilla.org/rdf/container;1"]
- .createInstance(Components.interfaces.nsIRDFContainer);
+ var masterSeq = Cc["@mozilla.org/rdf/container;1"]
+ .createInstance(Ci.nsIRDFContainer);
masterSeq.Init(sidebarObj.datasource, master_list);
var inmaster = (masterSeq.IndexOf(panel) != -1);
if (panel.Value in panels || inmaster) {
// This panel will remain in the sidebar.
// Remove the resource, but keep all the other attributes.
// Removing it will allow it to be added in the correct order.
// Saving the attributes will preserve things such as the exclude state.
@@ -500,17 +500,17 @@ function Save()
sidebarObj.container.AppendElement(resource);
} else {
copy_resource_deeply(all_panels.database, resource, sidebarObj.container);
}
}
refresh_all_sidebars();
// Write the modified panels out.
- sidebarObj.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
+ sidebarObj.datasource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();
}
// Search for an element in an array
function has_element(array, element) {
for (var ii=0; ii < array.length; ii++) {
if (array[ii] == element) {
return true;
}
--- a/suite/common/sidebar/sidebarOverlay.js
+++ b/suite/common/sidebar/sidebarOverlay.js
@@ -46,18 +46,18 @@ function setBlank()
// Uncomment for debug output
const SB_DEBUG = false;
// pref for limiting number of tabs in view
// initialized in sidebar_overlay_init()
var gNumTabsInViewPref;
// The rdf service
-var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
- .getService(Components.interfaces.nsIRDFService);
+var RDF = Cc["@mozilla.org/rdf/rdf-service;1"]
+ .getService(Ci.nsIRDFService);
const NC = "http://home.netscape.com/NC-rdf#";
// The directory services property to find panels.rdf
const PANELS_RDF_FILE = "UPnls";
const SIDEBAR_VERSION = "0.1";
// The default sidebar:
@@ -557,17 +557,17 @@ function ()
var rv = false;
var datasource = sidebarObj.datasource;
var persistNode = datasource.GetTarget(RDF.GetResource(this.id),
RDF.GetResource(NC + "persist"),
true);
if (persistNode)
{
persistNode =
- persistNode.QueryInterface(Components.interfaces.nsIRDFLiteral);
+ persistNode.QueryInterface(Ci.nsIRDFLiteral);
rv = persistNode.Value == 'true';
}
return rv;
}
sbPanel.prototype.select =
function (force_reload)
@@ -663,17 +663,17 @@ function ()
var panel_observer = {
onAssert : function(ds,src,prop,target) {
//debug ("observer: assert");
// "refresh" is asserted by select menu and by customize.js.
if (prop == RDF.GetResource(NC + "refresh")) {
sidebarObj.panels.initialized = false; // reset so panels are put in view
sidebarObj.panels.refresh();
} else if (prop == RDF.GetResource(NC + "refresh_panel")) {
- var panel_id = target.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
+ var panel_id = target.QueryInterface(Ci.nsIRDFLiteral).Value;
var panel = sidebarObj.panels.get_panel_from_id(panel_id);
panel.reload();
}
},
onUnassert : function(ds,src,prop,target) {
//debug ("observer: unassert");
},
onChange : function(ds,src,prop,old_target,new_target) {
@@ -831,23 +831,23 @@ function check_for_missing_panels() {
currTab = new sbPanel(currHeader.getAttribute("id"), currHeader, i);
if (!currTab.is_excluded()) {
if (currHeader.hasAttribute("prereq") && currHeader.getAttribute("prereq") != "") {
var prereq_file = currHeader.getAttribute("prereq");
var ios = Services.io;
var channel = ios.newChannel2(prereq_file, null, null, null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
try {
channel.open();
}
catch (ex) {
- if (ex.result != Components.results.NS_ERROR_FILE_NOT_FOUND) {
+ if (ex.result != Cr.NS_ERROR_FILE_NOT_FOUND) {
throw ex;
}
sidebarObj.datasource.Assert(RDF.GetResource(currHeader.getAttribute("id")),
RDF.GetResource(NC + "exclude"),
RDF.GetLiteral(sidebarObj.component),
true);
currTab.exclude();
}
@@ -891,28 +891,28 @@ function sidebar_revert_to_default_panel
sidebar_file.remove(false);
// Since we just removed the panels file,
// this should copy the defaults over.
sidebar_file = sidebar_get_panels_file();
debug("sidebar defaults reloaded");
var datasource = sidebarObj.datasource;
- datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Refresh(true);
+ datasource.QueryInterface(Ci.nsIRDFRemoteDataSource).Refresh(true);
} catch (ex) {
debug("Error: Unable to reload panel defaults file.\n");
}
return null;
}
function get_sidebar_datasource_uri() {
try {
var sidebar_file = sidebar_get_panels_file();
- var fileHandler = Services.io.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ var fileHandler = Services.io.getProtocolHandler("file").QueryInterface(Ci.nsIFileProtocolHandler);
return fileHandler.getURLSpecFromFile(sidebar_file);
} catch (ex) {
// This should not happen
debug("Error: Unable to load panels file.\n");
}
return null;
}
@@ -1320,17 +1320,17 @@ function SidebarTogglePanel(panel_menuit
if (did_exclude && !sidebarObj.panels.visible_panels_exist())
// surrender focus to main content area
window.content.focus();
else
// force all the sidebars to update
refresh_all_sidebars();
// Write the modified panels out.
- sidebarObj.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
+ sidebarObj.datasource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();
}
function SidebarNavigate(aDirection)
{
debug("SidebarNavigate " + aDirection);
var tabs = sidebarObj.panels.node.childNodes;
var i;
@@ -1587,18 +1587,18 @@ function SidebarBroadcastersToRDF()
// Translation rules to translate between new broadcaster id and old RDF id.
const TRANSLATE = {viewBookmarksSidebar: "bookmarks",
viewHistorySidebar: "history",
viewSearchSidebar: "search",
viewAddressbookSidebar: "addressbook"};
const URN_PREFIX = "urn:sidebar:panel:";
- const RDFCU = Components.classes['@mozilla.org/rdf/container-utils;1']
- .getService(Components.interfaces.nsIRDFContainerUtils);
+ const RDFCU = Cc['@mozilla.org/rdf/container-utils;1']
+ .getService(Ci.nsIRDFContainerUtils);
/*
* Initialize RDF stuff.
*/
let ds = sidebarObj.datasource;
let panelListRes = RDF.GetResource(NC + "panel-list");
let currentListRes = RDF.GetResource(sidebarObj.resource);
@@ -1649,35 +1649,35 @@ function SidebarBroadcastersToRDF()
ds.Assert(panelRes, titleRes, titleLit, true);
ds.Assert(panelRes, urlRes, urlLit, true);
masterSeq.AppendElement(panelRes);
if (currentSeq.IndexOf(panelRes) == -1)
currentSeq.AppendElement(panelRes);
}
// Item already exists, but perhaps we need to update...
else {
- let curtitle = curtitleLit.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
- let cururl = cururlLit.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
+ let curtitle = curtitleLit.QueryInterface(Ci.nsIRDFLiteral).Value;
+ let cururl = cururlLit.QueryInterface(Ci.nsIRDFLiteral).Value;
if (curtitle != title)
ds.Change(panelRes, titleRes, curtitleLit, titleLit);
if (cururl != url)
ds.Change(panelRes, urlRes, cururlLit, urlLit);
}
}
/*
* Do the same the other way around to delete obsolete sidebars.
*/
let masterElements = masterSeq.GetElements();
while (masterElements.hasMoreElements()) {
let curElementRes = masterElements.getNext();
- let curId = curElementRes.QueryInterface(Components.interfaces.nsIRDFResource).Value;
+ let curId = curElementRes.QueryInterface(Ci.nsIRDFResource).Value;
if (curId.substr(0, URN_PREFIX.length) != URN_PREFIX)
continue;
curId = curId.substr(URN_PREFIX.length);
if (!(curId in bclist)) {
let properties = ds.ArcLabelsOut(curElementRes);
while(properties.hasMoreElements()) {
@@ -1687,17 +1687,17 @@ function SidebarBroadcastersToRDF()
}
masterSeq.RemoveElement(curElementRes, true);
if (currentSeq.IndexOf(curElementRes) != -1)
currentSeq.RemoveElement(curElementRes, true);
}
}
// Write modified data.
- sidebarObj.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
+ sidebarObj.datasource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();
}
//////////////////////////////////////////////////////////////
// Install the load/unload handlers
//////////////////////////////////////////////////////////////
addEventListener("load", sidebar_overlay_init, false);
addEventListener("unload", sidebar_overlay_destruct, false);
--- a/suite/common/src/nsAbout.js
+++ b/suite/common/src/nsAbout.js
@@ -1,19 +1,19 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
-const SCRIPT = Components.interfaces.nsIAboutModule.ALLOW_SCRIPT;
-const UNTRUSTED = Components.interfaces.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT;
-const HIDE = Components.interfaces.nsIAboutModule.HIDE_FROM_ABOUTABOUT;
-const INDEXEDDB = Components.interfaces.nsIAboutModule.ENABLE_INDEXED_DB;
+const SCRIPT = Ci.nsIAboutModule.ALLOW_SCRIPT;
+const UNTRUSTED = Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT;
+const HIDE = Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT;
+const INDEXEDDB = Ci.nsIAboutModule.ENABLE_INDEXED_DB;
function About() { }
About.prototype = {
Flags: SCRIPT,
URI: "chrome://communicator/content/about.xhtml",
blockedFlags: SCRIPT | UNTRUSTED | HIDE,
blockedURI: "chrome://communicator/content/blockedSite.xhtml",
certerrorFlags: SCRIPT | UNTRUSTED | HIDE,
@@ -31,17 +31,17 @@ About.prototype = {
rightsFlags: SCRIPT | UNTRUSTED,
rightsURI: "chrome://branding/content/aboutRights.xhtml",
sessionrestoreFlags: SCRIPT | HIDE,
sessionrestoreURI: "chrome://communicator/content/aboutSessionRestore.xhtml",
// synctabsFlags: SCRIPT,
// synctabsURI: "chrome://communicator/content/aboutSyncTabs.xul",
classID: Components.ID("{d54f2c89-8fd6-4eeb-a7a4-51d4dcdf460f}"),
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIAboutModule]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
getModule: function(aURI) {
return aURI.pathQueryRef.replace(/-|\W.*$/g, "").toLowerCase();
},
getURIFlags: function(aURI) {
return this[this.getModule(aURI) + "Flags"];
},
@@ -49,25 +49,25 @@ About.prototype = {
newChannel: function(aURI, aLoadInfo) {
var module = this.getModule(aURI);
var newURI = Services.io.newURI(this[module + "URI"]);
var channel = aLoadInfo ?
Services.io.newChannelFromURIWithLoadInfo(newURI, aLoadInfo) :
Services.io.newChannelFromURI2(newURI, null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
channel.originalURI = aURI;
if (this[module + "Flags"] & UNTRUSTED)
channel.owner = null;
return channel;
},
getIndexedDBOriginPostfix: function(aURI) {
if (this.getURIFlags(aURI) & INDEXEDDB) {
return this[this.getModule(aURI) + "Postfix"] || null;
}
- throw Components.results.NS_ERROR_ILLEGAL_VALUE;
+ throw Cr.NS_ERROR_ILLEGAL_VALUE;
}
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([About]);
--- a/suite/common/src/nsGopherProtocolStubHandler.js
+++ b/suite/common/src/nsGopherProtocolStubHandler.js
@@ -16,54 +16,54 @@ function GopherProtocol()
{
}
GopherProtocol.prototype = {
classDescription: "Gopher protocol handler stub",
classID: Components.ID("{22042bdb-56e4-47c6-8b12-fdfa859c05a9}"),
// nsISupports
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIProtocolHandler]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]),
// nsIProtocolHandler
scheme: "gopher",
defaultPort: 70,
- protocolFlags: Components.interfaces.nsIProtocolHandler.URI_NORELATIVE |
- Components.interfaces.nsIProtocolHandler.URI_NOAUTH |
- Components.interfaces.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE,
+ protocolFlags: Ci.nsIProtocolHandler.URI_NORELATIVE |
+ Ci.nsIProtocolHandler.URI_NOAUTH |
+ Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE,
allowPort: function GP_allowPort(port, scheme) {
return false; // meaningless.
},
newURI: function GP_newURI(spec, charset, baseURI) {
- var uri = Components.classes["@mozilla.org/network/standard-url;1"]
- .createInstance(Components.interfaces.nsIStandardURL);
- uri.init(Components.interfaces.nsIStandardURL.URLTYPE_STANDARD,
+ var uri = Cc["@mozilla.org/network/standard-url;1"]
+ .createInstance(Ci.nsIStandardURL);
+ uri.init(Ci.nsIStandardURL.URLTYPE_STANDARD,
this.defaultPort, spec, charset, baseURI)
return uri;
},
newChannel: function GP_newChannel(inputURI) {
return this.newChannel2(inputURI, null);
},
newChannel2: function GP_newChannel2(inputURI, loadinfo) {
var ios = Services.io;
var newURI = ios.newURI("chrome://communicator/content/gopherAddon.xhtml");
// Create a chrome channel, and de-chrome it, to our information page.
var chan = loadinfo ? ios.newChannelFromURIWithLoadInfo(newURI, loadinfo) :
ios.newChannelFromURI2(newURI, null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
chan.originalURI = inputURI;
- chan.owner = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
- .getService(Components.interfaces.nsIScriptSecurityManager)
- .createCodebasePrincipal(inputURI, {});
+ chan.owner = Cc["@mozilla.org/scriptsecuritymanager;1"]
+ .getService(Ci.nsIScriptSecurityManager)
+ .createCodebasePrincipal(inputURI, {});
return chan;
}
};
/* Make our factory. */
var components = [ GopherProtocol ];
var NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
--- a/suite/common/src/nsSessionStartup.js
+++ b/suite/common/src/nsSessionStartup.js
@@ -43,27 +43,27 @@ function debug(aMsg) {
function SessionStartup() {
}
SessionStartup.prototype = {
// the state to restore at startup
_initialState: null,
- _sessionType: Components.interfaces.nsISessionStartup.NO_SESSION,
+ _sessionType: Ci.nsISessionStartup.NO_SESSION,
/* ........ Global Event Handlers .............. */
/**
* Initialize the component
*/
init: function sss_init() {
// get file references
let sessionFile = Services.dirsvc.get("ProfD",
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
sessionFile.append("sessionstore.json");
let doResumeSession = Services.prefs.getBoolPref("browser.sessionstore.resume_session_once") ||
Services.prefs.getIntPref("browser.startup.page") == 3;
var resumeFromCrash = Services.prefs.getBoolPref("browser.sessionstore.resume_from_crash");
// only continue if the session file exists
@@ -86,21 +86,21 @@ SessionStartup.prototype = {
let lastSessionCrashed =
this._initialState && this._initialState.session &&
this._initialState.session.state &&
this._initialState.session.state == STATE_RUNNING_STR;
// set the startup type
if (lastSessionCrashed && resumeFromCrash)
- this._sessionType = Components.interfaces.nsISessionStartup.RECOVER_SESSION;
+ this._sessionType = Ci.nsISessionStartup.RECOVER_SESSION;
else if (!lastSessionCrashed && doResumeSession)
- this._sessionType = Components.interfaces.nsISessionStartup.RESUME_SESSION;
+ this._sessionType = Ci.nsISessionStartup.RESUME_SESSION;
else if (this._initialState)
- this._sessionType = Components.interfaces.nsISessionStartup.DEFER_SESSION;
+ this._sessionType = Ci.nsISessionStartup.DEFER_SESSION;
else
this._initialState = null; // reset the state
if (this.doRestore()) {
// wait for the first browser window to open
Services.obs.addObserver(this, "sessionstore-windows-restored", true);
}
},
@@ -125,17 +125,17 @@ SessionStartup.prototype = {
Services.obs.removeObserver(this, "quit-application");
break;
case "sessionstore-windows-restored":
// no need in repeating this, since session type won't change
Services.obs.removeObserver(this, "sessionstore-windows-restored");
// free _initialState after nsSessionStore is done with it
this._initialState = null;
// reset session type after restore
- this._sessionType = Components.interfaces.nsISessionStartup.NO_SESSION;
+ this._sessionType = Ci.nsISessionStartup.NO_SESSION;
break;
}
},
/* ........ Public API ................*/
/**
* Get the session state as a string
@@ -144,18 +144,18 @@ SessionStartup.prototype = {
return this._initialState;
},
/**
* Determine whether there is a pending session restore.
* @returns bool
*/
doRestore: function sss_doRestore() {
- return this._sessionType == Components.interfaces.nsISessionStartup.RECOVER_SESSION ||
- this._sessionType == Components.interfaces.nsISessionStartup.RESUME_SESSION;
+ return this._sessionType == Ci.nsISessionStartup.RECOVER_SESSION ||
+ this._sessionType == Ci.nsISessionStartup.RESUME_SESSION;
},
/**
* Get the type of pending session store, if any.
*/
get sessionType() {
return this._sessionType;
},
@@ -165,55 +165,55 @@ SessionStartup.prototype = {
/**
* Reads a session state file into a string and lets
* observers modify the state before it's being used
*
* @param aFile is any nsIFile
* @returns a session state string
*/
_readStateFile: function sss_readStateFile(aFile) {
- var stateString = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ var stateString = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
stateString.data = this._readFile(aFile) || "";
Services.obs.notifyObservers(stateString, "sessionstore-state-read");
return stateString.data;
},
/**
* reads a file into a string
* @param aFile
* nsIFile
* @returns string
*/
_readFile: function sss_readFile(aFile) {
try {
- var stream = Components.classes["@mozilla.org/network/file-input-stream;1"]
- .createInstance(Components.interfaces.nsIFileInputStream);
+ var stream = Cc["@mozilla.org/network/file-input-stream;1"]
+ .createInstance(Ci.nsIFileInputStream);
stream.init(aFile, 0x01, 0, 0);
- var cvStream = Components.classes["@mozilla.org/intl/converter-input-stream;1"]
- .createInstance(Components.interfaces.nsIConverterInputStream);
- cvStream.init(stream, "UTF-8", 1024, Components.interfaces.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
+ var cvStream = Cc["@mozilla.org/intl/converter-input-stream;1"]
+ .createInstance(Ci.nsIConverterInputStream);
+ cvStream.init(stream, "UTF-8", 1024, Ci.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER);
var content = "";
var data = {};
while (cvStream.readString(4096, data)) {
content += data.value;
}
cvStream.close();
return content.replace(/\r\n?/g, "\n");
}
- catch (ex) { Components.utils.reportError(ex); }
+ catch (ex) { Cu.reportError(ex); }
return null;
},
/* ........ QueryInterface .............. */
- QueryInterface : XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
- Components.interfaces.nsISupportsWeakReference,
- Components.interfaces.nsISessionStartup]),
+ QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver,
+ Ci.nsISupportsWeakReference,
+ Ci.nsISessionStartup]),
classID: Components.ID("{4e6c1112-57b6-44ba-adf9-99fb573b0a30}")
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([SessionStartup]);
--- a/suite/common/src/nsSessionStore.js
+++ b/suite/common/src/nsSessionStore.js
@@ -124,20 +124,20 @@ function SessionStoreService() {
// get crash recovery state from prefs and allow for proper reaction to state changes
this._prefBranch.addObserver("sessionstore.resume_from_crash", this, true);
return this._prefBranch.getBoolPref("sessionstore.resume_from_crash");
});
}
SessionStoreService.prototype = {
classID: Components.ID("{d37ccdf1-496f-4135-9575-037180af010d}"),
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISessionStore,
- Components.interfaces.nsIDOMEventListener,
- Components.interfaces.nsIObserver,
- Components.interfaces.nsISupportsWeakReference]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsISessionStore,
+ Ci.nsIDOMEventListener,
+ Ci.nsIObserver,
+ Ci.nsISupportsWeakReference]),
// xul:tab attributes to (re)store (extensions might want to hook in here);
// the favicon is always saved for the about:sessionrestore page
xulAttributes: {"image": true},
// set default load state
_loadState: STATE_STOPPED,
@@ -220,35 +220,35 @@ SessionStoreService.prototype = {
this._prefBranch.getIntPref("sessionstore.max_concurrent_tabs");
this._prefBranch.addObserver("sessionstore.max_concurrent_tabs", this, true);
// Make sure gRestoreTabsProgressListener has a reference to sessionstore
// so that it can make calls back in
gRestoreTabsProgressListener.ss = this;
// get file references
- this._sessionFile = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ this._sessionFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
this._sessionFileBackup = this._sessionFile.clone();
this._sessionFile.append("sessionstore.json");
this._sessionFileBackup.append("sessionstore.bak");
// get string containing session state
- var ss = Components.classes["@mozilla.org/suite/sessionstartup;1"]
- .getService(Components.interfaces.nsISessionStartup);
+ var ss = Cc["@mozilla.org/suite/sessionstartup;1"]
+ .getService(Ci.nsISessionStartup);
try {
- if (ss.sessionType != Components.interfaces.nsISessionStartup.NO_SESSION)
+ if (ss.sessionType != Ci.nsISessionStartup.NO_SESSION)
this._initialState = ss.state;
}
catch(ex) { dump(ex + "\n"); } // no state to restore, which is ok
if (this._initialState) {
try {
// If we're doing a DEFERRED session, then we want to pull pinned tabs
// out so they can be restored.
- if (ss.sessionType == Components.interfaces.nsISessionStartup.DEFER_SESSION) {
+ if (ss.sessionType == Ci.nsISessionStartup.DEFER_SESSION) {
let [iniState, remainingState] = this._prepDataForDeferredRestore(this._initialState);
// If we have a iniState with windows, that means that we have windows
// with app tabs to restore.
if (iniState.windows.length)
this._initialState = iniState;
else
this._initialState = null;
if (remainingState.windows.length)
@@ -295,17 +295,17 @@ SessionStoreService.prototype = {
if (this._resume_from_crash) {
// create a backup if the session data file exists
try {
if (this._sessionFileBackup.exists())
this._sessionFileBackup.remove(false);
if (this._sessionFile.exists())
this._sessionFile.copyTo(null, this._sessionFileBackup.leafName);
}
- catch (ex) { Components.utils.reportError(ex); } // file was write-locked?
+ catch (ex) { Cu.reportError(ex); } // file was write-locked?
}
// at this point, we've as good as resumed the session, so we can
// clear the resume_session_once flag, if it's set
if (this._loadState != STATE_QUITTING &&
this._prefBranch.getBoolPref("sessionstore.resume_session_once"))
this._prefBranch.setBoolPref("sessionstore.resume_session_once", false);
@@ -426,17 +426,17 @@ SessionStoreService.prototype = {
delete this._windows[ix];
}
}
// also clear all data about closed windows
this._closedWindows = [];
// give the tabbrowsers a chance to clear their histories first
if (this._getMostRecentBrowserWindow())
Services.tm.mainThread.dispatch(this.saveState.bind(this, true),
- Components.interfaces.nsIThread.DISPATCH_NORMAL);
+ Ci.nsIThread.DISPATCH_NORMAL);
else if (this._loadState == STATE_RUNNING)
this.saveState(true);
break;
case "nsPref:changed": // catch pref changes
switch (aData) {
// if the user decreases the max number of closed tabs they want
// preserved update our internal states to match that max
case "sessionstore.max_tabs_undo":
@@ -568,17 +568,17 @@ SessionStoreService.prototype = {
// _loadState changed from "stopped" to "running"
// force a save operation so that crashes happening during startup are correctly counted
this.saveState(true);
}
else {
// Nothing to restore, notify observers things are complete.
this.windowToFocus = aWindow;
- Services.tm.mainThread.dispatch(this, Components.interfaces.nsIThread.DISPATCH_NORMAL);
+ Services.tm.mainThread.dispatch(this, Ci.nsIThread.DISPATCH_NORMAL);
// the next delayed save request should execute immediately
this._lastSaveTime -= this._interval;
}
}
// this window was opened by _openWindowWithState
else if (!this._isWindowLoaded(aWindow)) {
let followUp = this._statesToRestore[aWindow.__SS_restoreID].windows.length == 1;
@@ -921,17 +921,17 @@ SessionStoreService.prototype = {
setBrowserState: function sss_setBrowserState(aState) {
this._handleClosedWindows();
try {
var state = JSON.parse(aState);
}
catch (ex) { /* invalid state object - don't restore anything */ }
if (!state || !state.windows)
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
this._browserSetState = true;
// Make sure _tabsToRestore is emptied out
this._resetRestoringState();
var window = this._getMostRecentBrowserWindow();
if (!window) {
@@ -963,52 +963,52 @@ SessionStoreService.prototype = {
return this._toJSONString(this._getWindowState(aWindow));
}
if (DyingWindowCache.has(aWindow)) {
let data = DyingWindowCache.get(aWindow);
return this._toJSONString({ windows: [data] });
}
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
},
setWindowState: function sss_setWindowState(aWindow, aState, aOverwrite) {
if (!aWindow.__SSi)
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
this.restoreWindow(aWindow, aState, aOverwrite);
},
getTabState: function sss_getTabState(aTab) {
if (!aTab.ownerDocument || !aTab.ownerDocument.defaultView.__SSi)
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
var tabState = this._collectTabData(aTab);
var window = aTab.ownerDocument.defaultView;
this._updateTextAndScrollDataForTab(window, aTab.linkedBrowser, tabState);
return this._toJSONString(tabState);
},
setTabState: function sss_setTabState(aTab, aState) {
var tabState = JSON.parse(aState);
if (!tabState.entries || !aTab.ownerDocument || !aTab.ownerDocument.defaultView.__SSi)
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
var window = aTab.ownerDocument.defaultView;
this._sendWindowStateEvent(window, "Busy");
this.restoreHistoryPrecursor(window, [aTab], [tabState], 0, 0, 0);
},
duplicateTab: function sss_duplicateTab(aWindow, aTab, aDelta, aRelated) {
if (!aTab.ownerDocument || !aTab.ownerDocument.defaultView.__SSi ||
aWindow && !aWindow.getBrowser)
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
var tabState = this._collectTabData(aTab, true);
var sourceWindow = aTab.ownerDocument.defaultView;
this._updateTextAndScrollDataForTab(sourceWindow, aTab.linkedBrowser, tabState, true);
tabState.index += aDelta;
tabState.index = Math.max(1, Math.min(tabState.index, tabState.entries.length));
if (aWindow) {
@@ -1040,39 +1040,39 @@ SessionStoreService.prototype = {
if ("__SSi" in aWindow) {
return this._windows[aWindow.__SSi]._closedTabs.length;
}
if (DyingWindowCache.has(aWindow)) {
return DyingWindowCache.get(aWindow)._closedTabs.length;
}
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
},
getClosedTabData: function sss_getClosedTabData(aWindow) {
if ("__SSi" in aWindow) {
return this._toJSONString(this._windows[aWindow.__SSi]._closedTabs);
}
if (DyingWindowCache.has(aWindow)) {
let data = DyingWindowCache.get(aWindow);
return this._toJSONString(data._closedTabs);
}
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
},
undoCloseTab: function sss_undoCloseTab(aWindow, aIndex) {
if (!aWindow.__SSi)
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
var closedTabs = this._getClosedTabs(aWindow);
if (!(aIndex in closedTabs))
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
// fetch the data of closed tab, while removing it from the array
let closedTab = closedTabs[aIndex];
if (aIndex in this._windows[aWindow.__SSi]._closedTabs)
this._windows[aWindow.__SSi]._closedTabs.splice(aIndex, 1);
var tabbrowser = aWindow.getBrowser();
var index = tabbrowser.savedBrowsers.indexOf(closedTab);
this._sendWindowStateEvent(aWindow, "Busy");
@@ -1092,21 +1092,21 @@ SessionStoreService.prototype = {
// focus the tab's content area (bug 342432)
tab.linkedBrowser.focus();
return tab;
},
forgetClosedTab: function sss_forgetClosedTab(aWindow, aIndex) {
if (!aWindow.__SSi)
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
var closedTabs = this._getClosedTabs(aWindow);
if (!(aIndex in closedTabs))
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
// remove closed tab from the array
var closedTab = closedTabs[aIndex];
if (aIndex in this._windows[aWindow.__SSi]._closedTabs)
this._windows[aWindow.__SSi]._closedTabs.splice(aIndex, 1);
var tabbrowser = aWindow.getBrowser();
var index = tabbrowser.savedBrowsers.indexOf(closedTab);
if (index != -1)
@@ -1136,29 +1136,29 @@ SessionStoreService.prototype = {
if ("__SSi" in aWindow) {
var data = this._windows[aWindow.__SSi].extData || {};
return data[aKey] || "";
}
if (DyingWindowCache.has(aWindow)) {
let data = DyingWindowCache.get(aWindow).extData || {};
return data[aKey] || "";
}
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
},
setWindowValue: function sss_setWindowValue(aWindow, aKey, aStringValue) {
if (aWindow.__SSi) {
if (!this._windows[aWindow.__SSi].extData) {
this._windows[aWindow.__SSi].extData = {};
}
this._windows[aWindow.__SSi].extData[aKey] = aStringValue;
this.saveStateDelayed(aWindow);
}
else {
- throw (Components.returnCode = Components.results.NS_ERROR_INVALID_ARG);
+ throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
}
},
deleteWindowValue: function sss_deleteWindowValue(aWindow, aKey) {
if (aWindow.__SSi && this._windows[aWindow.__SSi].extData &&
this._windows[aWindow.__SSi].extData[aKey])
delete this._windows[aWindow.__SSi].extData[aKey];
},
@@ -1233,30 +1233,30 @@ SessionStoreService.prototype = {
* to merge data into the current session. If a window was opened at startup
* with pinned tab(s), then the remaining data from the previous session for
* that window will be opened into that winddow. Otherwise new windows will
* be opened.
*/
restoreLastSession: function sss_restoreLastSession() {
// Use the public getter since it also checks PB mode
if (!this.canRestoreLastSession)
- throw (Components.returnCode = Components.results.NS_ERROR_FAILURE);
+ throw (Components.returnCode = Cr.NS_ERROR_FAILURE);
// First collect each window with its id...
let windows = {};
this._forEachBrowserWindow(function(aWindow) {
if (aWindow.__SS_lastSessionWindowID)
windows[aWindow.__SS_lastSessionWindowID] = aWindow;
});
let lastSessionState = this._lastSessionState;
// This shouldn't ever be the case...
if (!lastSessionState.windows.length)
- throw (Components.returnCode = Components.results.NS_ERROR_UNEXPECTED);
+ throw (Components.returnCode = Cr.NS_ERROR_UNEXPECTED);
// We're technically doing a restore, so set things up so we send the
// notification when we're done. We want to send "sessionstore-browser-state-restored".
this._restoreCount = lastSessionState.windows.length;
this._browserSetState = true;
// We want to re-use the last opened window instead of opening a new one in
// the case where it's "empty" and not associated with a window in the session.
@@ -1532,17 +1532,17 @@ SessionStoreService.prototype = {
tabData.attributes[name] = aTab.getAttribute(name);
}
if (aTab.__SS_extdata)
tabData.extData = aTab.__SS_extdata;
else if (tabData.extData)
delete tabData.extData;
- if (history && browser.docShell instanceof Components.interfaces.nsIDocShell)
+ if (history && browser.docShell instanceof Ci.nsIDocShell)
this._serializeSessionStorage(tabData, history, browser.docShell, aFullData,
false);
return tabData;
},
/**
* Get an object that is a serialized representation of a History entry
@@ -1561,22 +1561,22 @@ SessionStoreService.prototype = {
triggeringPrincipal_base64: Utils.SERIALIZED_SYSTEMPRINCIPAL };
if (aEntry.title && aEntry.title != entry.url) {
entry.title = aEntry.title;
}
if (aEntry.isSubFrame) {
entry.subframe = true;
}
- if (!(aEntry instanceof Components.interfaces.nsISHEntry)) {
+ if (!(aEntry instanceof Ci.nsISHEntry)) {
return entry;
}
var cacheKey = aEntry.cacheKey;
- if (cacheKey && cacheKey instanceof Components.interfaces.nsISupportsPRUint32 &&
+ if (cacheKey && cacheKey instanceof Ci.nsISupportsPRUint32 &&
cacheKey.data != 0) {
// XXXbz would be better to have cache keys implement
// nsISerializable or something.
entry.cacheKey = cacheKey.data;
}
entry.ID = aEntry.ID;
entry.docshellUUID = aEntry.docshellID.toString();
@@ -1590,20 +1590,20 @@ SessionStoreService.prototype = {
aEntry.getScrollPosition(x, y);
if (x.value != 0 || y.value != 0)
entry.scroll = x.value + "," + y.value;
try {
var prefPostdata = this._prefBranch.getIntPref("sessionstore.postdata");
if (aEntry.postData && (aFullData || prefPostdata &&
this._checkPrivacyLevel(aEntry.URI.schemeIs("https"), aIsPinned))) {
- aEntry.postData.QueryInterface(Components.interfaces.nsISeekableStream)
- .seek(Components.interfaces.nsISeekableStream.NS_SEEK_SET, 0);
- var stream = Components.classes["@mozilla.org/binaryinputstream;1"]
- .createInstance(Components.interfaces.nsIBinaryInputStream);
+ aEntry.postData.QueryInterface(Ci.nsISeekableStream)
+ .seek(Ci.nsISeekableStream.NS_SEEK_SET, 0);
+ var stream = Cc["@mozilla.org/binaryinputstream;1"]
+ .createInstance(Ci.nsIBinaryInputStream);
stream.setInputStream(aEntry.postData);
var postBytes = stream.readByteArray(stream.available());
var postdata = String.fromCharCode.apply(null, postBytes);
if (aFullData || prefPostdata == -1 ||
postdata.replace(/^(Content-.*\r\n)+(\r\n)*/, "").length <=
prefPostdata) {
// We can stop doing base64 encoding once our serialization into JSON
// is guaranteed to handle all chars in strings, including embedded
@@ -1647,17 +1647,17 @@ SessionStoreService.prototype = {
entry.docIdentifier = aEntry.BFCacheEntry.ID;
if (aEntry.stateData) {
entry.structuredCloneState = aEntry.stateData.getDataAsBase64();
entry.structuredCloneVersion = aEntry.stateData.formatVersion;
}
- if (!(aEntry instanceof Components.interfaces.nsISHContainer)) {
+ if (!(aEntry instanceof Ci.nsISHContainer)) {
return entry;
}
if (aEntry.childCount > 0) {
entry.children = [];
for (var i = 0; i < aEntry.childCount; i++) {
var child = aEntry.GetChildAt(i);
if (child) {
@@ -1714,20 +1714,20 @@ SessionStoreService.prototype = {
continue;
let isHTTPS = principal.uri && principal.url.schemeIs("https");
if (!(aFullData || this._checkPrivacyLevel(isHTTPS, aIsPinned)))
continue;
let storage, storageItemCount = 0;
- let window = aDocShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow);
+ let window = aDocShell.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
try {
- let storageManager = aDocShell.QueryInterface(Components.interfaces.nsIDOMStorageManager);
+ let storageManager = aDocShell.QueryInterface(Ci.nsIDOMStorageManager);
storage = storageManager.getStorage(window, principal);
// See Bug 1232955 - storage.length can throw, catch that failure here inside the try.
if (storage)
storageItemCount = storage.length;
}
catch (ex) { /* sessionStorage might throw if it's turned off, see bug 458954 */ }
@@ -1846,18 +1846,18 @@ SessionStoreService.prototype = {
aContent.addEventListener("keypress", this.saveStateDelayed.bind(this, aWindow, 3000), true);
}
aData.innerHTML = aContent.document.body.innerHTML;
}
}
// get scroll position from nsIDOMWindowUtils, since it allows avoiding a
// flush of layout
- let domWindowUtils = aContent.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindowUtils);
+ let domWindowUtils = aContent.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
let scrollX = {}, scrollY = {};
domWindowUtils.getScrollXY(false, scrollX, scrollY);
aData.scroll = scrollX.value + "," + scrollY.value;
},
/**
* determine the title of the currently enabled style sheet (if any)
* and recurse through the frameset if necessary
@@ -1901,17 +1901,17 @@ SessionStoreService.prototype = {
let nId = node.id;
let hasDefaultValue = true;
let value;
// Only generate a limited number of XPath expressions for perf reasons (cf. bug 477564)
if (!nId && generatedCount > MAX_GENERATED_XPATHS)
continue;
- if (node instanceof Components.interfaces.nsIDOMHTMLInputElement ||
+ if (node instanceof Ci.nsIDOMHTMLInputElement ||
ChromeUtils.getClassName(node) === "HTMLTextAreaElement") {
switch (node.type) {
case "checkbox":
case "radio":
value = node.checked;
hasDefaultValue = value == node.defaultChecked;
break;
case "file":
@@ -2030,17 +2030,17 @@ SessionStoreService.prototype = {
this._extractHostsForCookiesFromEntry(entry, hosts, true, tab.pinned);
}, this);
}, this);
for (var [host, isPinned] of Object.entries(hosts)) {
try {
var list = Services.cookies.getCookiesFromHost(host, {});
while (list.hasMoreElements()) {
- var cookie = list.getNext().QueryInterface(Components.interfaces.nsICookie2);
+ var cookie = list.getNext().QueryInterface(Ci.nsICookie2);
// window._hosts will only have hosts with the right privacy rules,
// so there is no need to do anything special with this call to
// _checkPrivacyLevel.
if (cookie.isSession && this._checkPrivacyLevel(cookie.isSecure, isPinned)) {
// use the cookie's host, path, and name as keys into a hash,
// to make sure we serialize each cookie only once
// lazily build up a 3-dimensional hash, with
@@ -2594,17 +2594,17 @@ SessionStoreService.prototype = {
var tabData = aTabData.shift();
var browser = aWindow.getBrowser().getBrowserForTab(tab);
var history = browser.webNavigation.sessionHistory;
if (history.count > 0) {
history.PurgeHistory(history.count);
}
- history.QueryInterface(Components.interfaces.nsISHistoryInternal);
+ history.QueryInterface(Ci.nsISHistoryInternal);
browser.__SS_shistoryListener = new SessionStoreSHistoryListener(this, tab);
history.addSHistoryListener(browser.__SS_shistoryListener);
if (!tabData.entries) {
tabData.entries = [];
}
if (tabData.extData) {
@@ -2628,27 +2628,27 @@ SessionStoreService.prototype = {
CAPABILITIES.forEach(function(aCapability) {
browser.docShell["allow" + aCapability] = disallow.indexOf(aCapability) == -1;
});
for (let name in this.xulAttributes)
tab.removeAttribute(name);
for (let name in tabData.attributes)
tab.setAttribute(name, tabData.attributes[name]);
- if (tabData.storage && browser.docShell instanceof Components.interfaces.nsIDocShell)
+ if (tabData.storage && browser.docShell instanceof Ci.nsIDocShell)
this._deserializeSessionStorage(tabData.storage, browser.docShell);
// notify the tabbrowser that the tab chrome has been restored
var event = aWindow.document.createEvent("Events");
event.initEvent("SSTabRestoring", true, false);
tab.dispatchEvent(event);
// Restore the history in the next tab
Services.tm.mainThread.dispatch(this.restoreHistory.bind(this, aWindow,
- aTabs, aTabData, aIdMap, aDocIdentMap), Components.interfaces.nsIThread.DISPATCH_NORMAL);
+ aTabs, aTabData, aIdMap, aDocIdentMap), Ci.nsIThread.DISPATCH_NORMAL);
// This could cause us to ignore the max_concurrent_tabs pref a bit, but
// it ensures each window will have its selected tab loaded.
if (aWindow.getBrowser().selectedBrowser == browser) {
this.restoreTab(tab);
}
else {
// Put the tab into the right bucket
@@ -2708,17 +2708,17 @@ SessionStoreService.prototype = {
// Reset currentURI.
browser.webNavigation.setCurrentURI(this._getURIFromString("about:blank"));
// Attach data that will be restored on "load" event, after tab is restored.
if (activeIndex > -1) {
let curSHEntry = browser.webNavigation.sessionHistory
.getEntryAtIndex(activeIndex, false)
- .QueryInterface(Components.interfaces.nsISHEntry);
+ .QueryInterface(Ci.nsISHEntry);
// restore those aspects of the currently active documents which are not
// preserved in the plain history entries (mainly scroll state and text data)
browser.__SS_restore_data = tabData.entries[activeIndex] || {};
browser.__SS_restore_pageStyle = tabData.pageStyle || "";
browser.__SS_restore_tab = aTab;
didStartLoad = true;
@@ -2744,17 +2744,17 @@ SessionStoreService.prototype = {
if (tabData.userTypedClear) {
// Make it so that we'll enter restoreDocument on page load. We will
// fire SSTabRestored from there. We don't have any form data to restore
// so we can just set the URL to null.
browser.__SS_restore_data = { url: null };
browser.__SS_restore_tab = aTab;
didStartLoad = true;
browser.loadURI(tabData.userTypedValue,
- Components.interfaces.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP,
+ Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP,
null, null, null);
}
}
// If we didn't start a load, then we won't reset this tab through the usual
// channel (via the progress listener), so reset the tab ourselves. We will
// also send SSTabRestored since this tab has technically been restored.
@@ -2809,32 +2809,32 @@ SessionStoreService.prototype = {
* Object containing serialized history data for a URL
* @param aIdMap
* Hash for ensuring unique frame IDs
* @returns nsISHEntry
*/
_deserializeHistoryEntry:
function sss_deserializeHistoryEntry(aEntry, aIdMap, aDocIdentMap) {
- var shEntry = Components.classes["@mozilla.org/browser/session-history-entry;1"]
- .createInstance(Components.interfaces.nsISHEntry);
+ var shEntry = Cc["@mozilla.org/browser/session-history-entry;1"]
+ .createInstance(Ci.nsISHEntry);
shEntry.setURI(this._getURIFromString(aEntry.url));
shEntry.setTitle(aEntry.title || aEntry.url);
if (aEntry.subframe)
shEntry.setIsSubFrame(aEntry.subframe || false);
- shEntry.loadType = Components.interfaces.nsIDocShellLoadInfo.loadHistory;
+ shEntry.loadType = Ci.nsIDocShellLoadInfo.loadHistory;
if (aEntry.contentType)
shEntry.contentType = aEntry.contentType;
if (aEntry.referrer)
shEntry.referrerURI = this._getURIFromString(aEntry.referrer);
if (aEntry.cacheKey) {
- var cacheKey = Components.classes["@mozilla.org/supports-PRUint32;1"]
- .createInstance(Components.interfaces.nsISupportsPRUint32);
+ var cacheKey = Cc["@mozilla.org/supports-PRUint32;1"]
+ .createInstance(Ci.nsISupportsPRUint32);
cacheKey.data = aEntry.cacheKey;
shEntry.cacheKey = cacheKey;
}
if (aEntry.ID) {
// get a new unique ID for this frame (since the one from the last
// start might already be in use)
var id = aIdMap[aEntry.ID] || 0;
@@ -2859,33 +2859,33 @@ SessionStoreService.prototype = {
delete aEntry.docshellID;
}
if (aEntry.docshellUUID)
shEntry.docshellID = Components.ID(aEntry.docshellUUID);
if (aEntry.structuredCloneState && aEntry.structuredCloneVersion) {
shEntry.stateData =
- Components.classes["@mozilla.org/docshell/structured-clone-container;1"]
- .createInstance(Components.interfaces.nsIStructuredCloneContainer);
+ Cc["@mozilla.org/docshell/structured-clone-container;1"]
+ .createInstance(Ci.nsIStructuredCloneContainer);
shEntry.stateData.initFromBase64(aEntry.structuredCloneState,
aEntry.structuredCloneVersion);
}
if (aEntry.scroll) {
var scrollPos = (aEntry.scroll || "0,0").split(",");
scrollPos = [parseInt(scrollPos[0]) || 0, parseInt(scrollPos[1]) || 0];
shEntry.setScrollPosition(scrollPos[0], scrollPos[1]);
}
if (aEntry.postdata_b64) {
var postdata = atob(aEntry.postdata_b64);
- var stream = Components.classes["@mozilla.org/io/string-input-stream;1"]
- .createInstance(Components.interfaces.nsIStringInputStream);
+ var stream = Cc["@mozilla.org/io/string-input-stream;1"]
+ .createInstance(Ci.nsIStringInputStream);
stream.setData(postdata, postdata.length);
shEntry.postData = stream;
}
let childDocIdents = {};
if (aEntry.docIdentifier) {
// If we have a serialized document identifier, try to find an SHEntry
// which matches that doc identifier and adopt that SHEntry's
@@ -2942,17 +2942,17 @@ SessionStoreService.prototype = {
shEntry.triggeringPrincipal = Utils.deserializePrincipal(aEntry.triggeringPrincipal_b64);
shEntry.principalToInherit = shEntry.triggeringPrincipal;
}
catch (e) {
debug(e);
}
}
- if (aEntry.children && shEntry instanceof Components.interfaces.nsISHContainer) {
+ if (aEntry.children && shEntry instanceof Ci.nsISHContainer) {
for (var i = 0; i < aEntry.children.length; i++) {
//XXXzpao Wallpaper patch for bug 509315
if (!aEntry.children[i].url)
continue;
// We're mysteriously getting sessionrestore.js files with a cycle in
// the doc-identifier graph. (That is, we have an entry where doc
// identifier A is an ancestor of doc identifier B, and another entry
@@ -2990,35 +2990,35 @@ SessionStoreService.prototype = {
let principal;
try {
let attrs = aDocShell.getOriginAttributes();
let originURI = Services.io.newURI(origin);
principal = Services.scriptSecurityManager.createCodebasePrincipal(originURI, attrs);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
continue;
}
- let storageManager = aDocShell.QueryInterface(Components.interfaces.nsIDOMStorageManager);
- let window = aDocShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIDOMWindow);
+ let storageManager = aDocShell.QueryInterface(Ci.nsIDOMStorageManager);
+ let window = aDocShell.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
// There is no need to pass documentURI, it's only used to fill documentURI property of
// domstorage event, which in this case has no consumer. Prevention of events in case
// of missing documentURI will be solved in a followup bug to bug 600307.
let storage = storageManager.createStorage(window, principal, "");
for (let key of Object.keys(data)) {
try {
storage.setItem(key, data[key]);
} catch (e) {
// Throws e.g. for URIs that can't have sessionStorage.
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
}
},
/**
* Restore properties to a loaded document
*/
@@ -3155,17 +3155,17 @@ SessionStoreService.prototype = {
delete this._windows[aWindow.__SSi].isPopup;
Services.tm.mainThread.dispatch(this.restoreDimensions.bind(this, aWindow,
+aWinData.width || 0,
+aWinData.height || 0,
"screenX" in aWinData ? +aWinData.screenX : NaN,
"screenY" in aWinData ? +aWinData.screenY : NaN,
aWinData.sizemode || "", aWinData.sidebar || ""),
- Components.interfaces.nsIThread.DISPATCH_NORMAL);
+ Ci.nsIThread.DISPATCH_NORMAL);
},
/**
* Restore a window's dimensions
* @param aWidth
* Window width
* @param aHeight
* Window height
@@ -3251,17 +3251,17 @@ SessionStoreService.prototype = {
var cookie = aCookies[i];
try {
Services.cookies.add(cookie.host, cookie.path || "", cookie.name || "",
cookie.value, !!cookie.secure, !!cookie.httponly,
true,
"expiry" in cookie ? cookie.expiry : MAX_EXPIRY,
"originAttributes" in cookie ? cookie.originAttributes : {});
}
- catch (ex) { Components.utils.reportError(ex); } // don't let a single cookie stop recovering
+ catch (ex) { Cu.reportError(ex); } // don't let a single cookie stop recovering
}
},
/* ........ Disk Access .............. */
/**
* save state delayed by N ms
* marks window as dirty (i.e. data update can't be skipped)
@@ -3277,18 +3277,18 @@ SessionStoreService.prototype = {
if (!this._saveTimer && this._resume_from_crash) {
// interval until the next disk operation is allowed
var minimalDelay = this._lastSaveTime + this._interval - Date.now();
// if we have to wait, set a timer, otherwise saveState directly
aDelay = Math.max(minimalDelay, aDelay || 2000);
if (aDelay > 0) {
- this._saveTimer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
- this._saveTimer.init(this, aDelay, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ this._saveTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+ this._saveTimer.init(this, aDelay, Ci.nsITimer.TYPE_ONE_SHOT);
}
else {
this.saveState();
}
}
},
/**
@@ -3311,18 +3311,18 @@ SessionStoreService.prototype = {
this._saveStateObject(oState);
},
/**
* write a state object to disk
*/
_saveStateObject: function sss_saveStateObject(aStateObj) {
- var stateString = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ var stateString = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
// parentheses are for backwards compatibility with older sessionstore files
stateString.data = this._toJSONString(aStateObj);
Services.obs.notifyObservers(stateString, "sessionstore-state-write");
// don't touch the file if an observer has deleted all state data
if (stateString.data)
this._writeFile(this._sessionFile, stateString.data);
@@ -3418,18 +3418,18 @@ SessionStoreService.prototype = {
/**
* open a new browser window for a given session state
* called when restoring a multi-window session
* @param aState
* Object containing session data
*/
_openWindowWithState: function sss_openWindowWithState(aState) {
- var argString = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ var argString = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
argString.data = "about:blank";
var features = "chrome,dialog=no,suppressanimation,all";
var winState = aState.windows[0];
for (var aAttr in WINDOW_ATTRIBUTES) {
// Use !isNaN as an easy way to ignore sizemode and check for numbers
if (aAttr in winState && !isNaN(winState[aAttr]))
features += "," + WINDOW_ATTRIBUTES[aAttr] + "=" + winState[aAttr];
@@ -3473,18 +3473,18 @@ SessionStoreService.prototype = {
this._prefBranch.getBoolPref("sessionstore.resume_session_once");
},
/**
* Are we restarting to switch profile.
* @returns bool
*/
_isSwitchingProfile: function sss_isSwitchingProfile() {
- var env = Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment);
+ var env = Cc["@mozilla.org/process/environment;1"]
+ .getService(Ci.nsIEnvironment);
return env.exists("XRE_PROFILE_NAME");
},
/**
* whether the user wants to load any other page at startup
* (except the homepage) - needed for determining whether to overwrite the current tabs
* C.f.: nsBrowserContentHandler's defaultArgs implementation.
* @returns bool
@@ -3564,17 +3564,17 @@ SessionStoreService.prototype = {
currentURI.userPass = "";
}
catch (ex) { } // ignore failures on about: URIs
CrashReporter.annotateCrashReport("URL", currentURI.spec);
}
catch (ex) {
// don't make noise when crashreporter is built but not enabled
- if (ex.result != Components.results.NS_ERROR_NOT_INITIALIZED)
+ if (ex.result != Cr.NS_ERROR_NOT_INITIALIZED)
debug(ex);
}
#endif
},
/**
* @param aState is a session state
* @param aRecentCrashes is the number of consecutive crashes
@@ -3765,17 +3765,17 @@ SessionStoreService.prototype = {
_toJSONString: function sss_toJSONString(aJSObject) {
return JSON.stringify(aJSObject);
},
_sendRestoreCompletedNotifications: function sss_sendRestoreCompletedNotifications() {
if (this._restoreCount) {
this._restoreCount--;
if (this._restoreCount == 0)
- Services.tm.mainThread.dispatch(this, Components.interfaces.nsIThread.DISPATCH_NORMAL);
+ Services.tm.mainThread.dispatch(this, Ci.nsIThread.DISPATCH_NORMAL);
}
},
run: function sss_run() {
// This was the last window restored at startup, notify observers.
Services.obs.notifyObservers(this.windowToFocus,
this._browserSetState ? NOTIFY_BROWSER_STATE_RESTORED : NOTIFY_WINDOWS_RESTORED);
this._browserSetState = false;
@@ -3959,23 +3959,23 @@ SessionStoreService.prototype = {
* write file to disk
* @param aFile
* nsIFile
* @param aData
* String data
*/
_writeFile: function sss_writeFile(aFile, aData) {
// Initialize the file output stream.
- var ostream = Components.classes["@mozilla.org/network/safe-file-output-stream;1"]
- .createInstance(Components.interfaces.nsIFileOutputStream);
+ var ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"]
+ .createInstance(Ci.nsIFileOutputStream);
ostream.init(aFile, 0x02 | 0x08 | 0x20, parseInt("0600", 8), ostream.DEFER_OPEN);
// Obtain a converter to convert our data to a UTF-8 encoded input stream.
- var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
- .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+ var converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+ .createInstance(Ci.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
// Asynchronously copy the data to the file.
var istream = converter.convertToInputStream(aData);
var ObserverService = this._observerService;
NetUtil.asyncCopy(istream, ostream, function(rc) {
if (Components.isSuccessCode(rc)) {
Services.obs.notifyObservers(null,
@@ -4126,19 +4126,19 @@ var DirtyWindows = {
// point for telling the next tab to restore. It gets attached to each gBrowser
// via gBrowser.addTabsProgressListener
var gRestoreTabsProgressListener = {
ss: null,
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
// Ignore state changes on browsers that we've already restored and state
// changes that aren't applicable.
if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW) {
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW) {
// We need to reset the tab before starting the next restore.
let tab = this.ss._getTabForBrowser(aBrowser);
this.ss._resetTabRestoringState(tab);
this.ss.restoreNextTab();
}
}
}
@@ -4146,18 +4146,18 @@ var gRestoreTabsProgressListener = {
// restored. We need to catch reloads that occur before the tab is restored
// because otherwise, docShell will reload an old URI (usually about:blank).
function SessionStoreSHistoryListener(ss, aTab) {
this.tab = aTab;
this.ss = ss;
}
SessionStoreSHistoryListener.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISHistoryListener,
- Components.interfaces.nsISupportsWeakReference]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsISHistoryListener,
+ Ci.nsISupportsWeakReference]),
browser: null,
ss: null,
tab: null,
OnHistoryNewEntry: function(aNewURI) { },
OnHistoryGoBack: function(aBackURI) { return true; },
OnHistoryGoForward: function(aForwardURI) { return true; },
OnHistoryGotoIndex: function(aIndex, aGotoURI) { return true; },
OnHistoryPurge: function(aNumEntries) { return true; },
--- a/suite/common/src/nsSidebar.js
+++ b/suite/common/src/nsSidebar.js
@@ -19,49 +19,49 @@
const DEBUG = false; /* set to false to suppress debug messages */
const PANELS_RDF_FILE = "UPnls"; /* directory services property to find panels.rdf */
const SIDEBAR_CONTRACTID = "@mozilla.org/sidebar;1";
const SIDEBAR_CID = Components.ID("{22117140-9c6e-11d3-aaf1-00805f8a4905}");
const CONTAINER_CONTRACTID = "@mozilla.org/rdf/container;1";
const NETSEARCH_CONTRACTID = "@mozilla.org/rdf/datasource;1?name=internetsearch"
-const nsISupports = Components.interfaces.nsISupports;
-const nsISidebar = Components.interfaces.nsISidebar;
-const nsIRDFContainer = Components.interfaces.nsIRDFContainer;
-const nsIProperties = Components.interfaces.nsIProperties;
-const nsIFileURL = Components.interfaces.nsIFileURL;
-const nsIRDFRemoteDataSource = Components.interfaces.nsIRDFRemoteDataSource;
-const nsIClassInfo = Components.interfaces.nsIClassInfo;
+const nsISupports = Ci.nsISupports;
+const nsISidebar = Ci.nsISidebar;
+const nsIRDFContainer = Ci.nsIRDFContainer;
+const nsIProperties = Ci.nsIProperties;
+const nsIFileURL = Ci.nsIFileURL;
+const nsIRDFRemoteDataSource = Ci.nsIRDFRemoteDataSource;
+const nsIClassInfo = Ci.nsIClassInfo;
// File extension for Sherlock search plugin description files
const SHERLOCK_FILE_EXT_REGEXP = /\.src$/i;
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
function nsSidebar()
{
const RDF_CONTRACTID = "@mozilla.org/rdf/rdf-service;1";
- const nsIRDFService = Components.interfaces.nsIRDFService;
+ const nsIRDFService = Ci.nsIRDFService;
- this.rdf = Components.classes[RDF_CONTRACTID].getService(nsIRDFService);
+ this.rdf = Cc[RDF_CONTRACTID].getService(nsIRDFService);
this.datasource_uri = getSidebarDatasourceURI(PANELS_RDF_FILE);
gDebugLog('datasource_uri is ' + this.datasource_uri);
this.resource = 'urn:sidebar:current-panel-list';
this.datasource = this.rdf.GetDataSource(this.datasource_uri);
}
nsSidebar.prototype.nc = "http://home.netscape.com/NC-rdf#";
nsSidebar.prototype.isPanel =
function (aContentURL)
{
var container =
- Components.classes[CONTAINER_CONTRACTID].createInstance(nsIRDFContainer);
+ Cc[CONTAINER_CONTRACTID].createInstance(nsIRDFContainer);
container.Init(this.datasource, this.rdf.GetResource(this.resource));
/* Create a resource for the new panel and add it to the list */
var panel_resource =
this.rdf.GetResource("urn:sidebar:3rdparty-panel:" + aContentURL);
return (container.IndexOf(panel_resource) != -1);
@@ -96,23 +96,23 @@ nsSidebar.prototype.addPanelInternal =
function (aTitle, aContentURL, aCustomizeURL, aPersist)
{
sidebarURLSecurityCheck(aContentURL);
// Create a "container" wrapper around the current panels to
// manipulate the RDF:Seq more easily.
var panel_list = this.datasource.GetTarget(this.rdf.GetResource(this.resource), this.rdf.GetResource(nsSidebar.prototype.nc+"panel-list"), true);
if (panel_list) {
- panel_list.QueryInterface(Components.interfaces.nsIRDFResource);
+ panel_list.QueryInterface(Ci.nsIRDFResource);
} else {
// Datasource is busted. Start over.
gDebugLog("Sidebar datasource is busted\n");
}
- var container = Components.classes[CONTAINER_CONTRACTID].createInstance(nsIRDFContainer);
+ var container = Cc[CONTAINER_CONTRACTID].createInstance(nsIRDFContainer);
container.Init(this.datasource, panel_list);
/* Create a resource for the new panel and add it to the list */
var panel_resource =
this.rdf.GetResource("urn:sidebar:3rdparty-panel:" + aContentURL);
var panel_index = container.IndexOf(panel_resource);
var stringBundle, brandStringBundle, titleMessage, dialogMessage;
if (panel_index != -1)
@@ -214,17 +214,17 @@ function (engineURL, iconURL)
throw "Unsupported search engine URL";
if (iconURL && !isWeb.test(iconURL))
throw "Unsupported search icon URL.";
}
catch(ex)
{
gDebugLog(ex);
- Components.utils.reportError("Invalid argument passed to window.sidebar.addSearchEngine: " + ex);
+ Cu.reportError("Invalid argument passed to window.sidebar.addSearchEngine: " + ex);
var searchBundle = Services.strings.createBundle("chrome://global/locale/search/search.properties");
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
var brandName = brandBundle.GetStringFromName("brandShortName");
var title = searchBundle.GetStringFromName("error_invalid_engine_title");
var msg = searchBundle.formatStringFromName("error_invalid_engine_msg",
[brandName], 1);
Services.ww.getNewPrompter(null).alert(title, msg);
@@ -245,19 +245,19 @@ function (engineURL, iconURL, suggestedT
if (!this.validateSearchEngine(engineURL, iconURL))
return;
// OpenSearch files will likely be far more common than Sherlock files, and
// have less consistent suffixes, so we assume that ".src" is a Sherlock
// (text) file, and anything else is OpenSearch (XML).
var dataType;
if (SHERLOCK_FILE_EXT_REGEXP.test(engineURL))
- dataType = Components.interfaces.nsISearchEngine.DATA_TEXT;
+ dataType = Ci.nsISearchEngine.DATA_TEXT;
else
- dataType = Components.interfaces.nsISearchEngine.DATA_XML;
+ dataType = Ci.nsISearchEngine.DATA_XML;
Services.search.addEngine(engineURL, dataType, iconURL, true);
}
// This function exists largely to implement window.external.AddSearchProvider(),
// to match other browsers' APIs. The capitalization, although nonstandard here,
// is therefore important.
nsSidebar.prototype.AddSearchProvider =
@@ -275,17 +275,17 @@ function (aDescriptionURL)
if (browser.shouldLoadFavIcon(browser.selectedBrowser
.contentDocument
.documentURIObject))
iconURL = browser.getIcon();
if (!this.validateSearchEngine(aDescriptionURL, iconURL))
return;
- const typeXML = Components.interfaces.nsISearchEngine.DATA_XML;
+ const typeXML = Ci.nsISearchEngine.DATA_XML;
Services.search.addEngine(aDescriptionURL, typeXML, iconURL, true);
}
// This function exists to implement window.external.IsSearchProviderInstalled(),
// for compatibility with other browsers. It will return an integer value
// indicating whether the given engine is installed for the current user.
// However, it is currently stubbed out due to security/privacy concerns
// stemming from difficulties in determining what domain issued the request.
@@ -325,27 +325,27 @@ function getSidebarDatasourceURI(panels_
try
{
/* use the fileLocator to look in the profile directory
* to find 'panels.rdf', which is the
* database of the user's currently selected panels.
* if <profile>/panels.rdf doesn't exist, get will copy
*bin/defaults/profile/panels.rdf to <profile>/panels.rdf */
var sidebar_file = Services.dirsvc.get(panels_file_id,
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
if (!sidebar_file.exists())
{
/* this should not happen, as GetFileLocation() should copy
* defaults/panels.rdf to the users profile directory */
gDebugLog("sidebar file does not exist");
return null;
}
- var file_handler = Services.io.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ var file_handler = Services.io.getProtocolHandler("file").QueryInterface(Ci.nsIFileProtocolHandler);
var sidebar_uri = file_handler.getURLSpecFromFile(sidebar_file);
gDebugLog("sidebar uri is " + sidebar_uri);
return sidebar_uri;
}
catch (ex)
{
/* this should not happen */
gDebugLog("caught " + ex + " getting sidebar datasource uri");
--- a/suite/common/src/nsSuiteGlue.js
+++ b/suite/common/src/nsSuiteGlue.js
@@ -56,17 +56,17 @@ const listeners = {
},
receiveMessage(modules, data) {
let val;
for (let module of modules[data.name]) {
try {
val = global[module].receiveMessage(data) || val;
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
return val;
},
init() {
let receiveMessageMM = this.receiveMessage.bind(this, this.mm);
for (let message of Object.keys(this.mm)) {
@@ -99,17 +99,17 @@ var gTaskbarProgress;
var gWinTaskbar;
var gDownloadsSummary;
function onSummaryChanged()
{
if (!gTaskbarProgress)
return;
- const nsITaskbarProgress = Components.interfaces.nsITaskbarProgress;
+ const nsITaskbarProgress = Ci.nsITaskbarProgress;
var currentBytes = gDownloadsSummary.progressCurrentBytes;
var totalBytes = gDownloadsSummary.progressTotalBytes;
var state = gDownloadsSummary.allHaveStopped ?
currentBytes ? nsITaskbarProgress.STATE_PAUSED :
nsITaskbarProgress.STATE_NO_PROGRESS :
currentBytes < totalBytes ? nsITaskbarProgress.STATE_NORMAL :
nsITaskbarProgress.STATE_INDETERMINATE;
switch (state) {
@@ -143,24 +143,24 @@ SuiteGlue.prototype = {
_setPrefToSaveSession: function()
{
Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true);
},
_logConsoleAPI: function(aEvent)
{
- const nsIScriptError = Components.interfaces.nsIScriptError;
+ const nsIScriptError = Ci.nsIScriptError;
var flg = nsIScriptError.errorFlag;
switch (aEvent.level) {
case "warn":
flg = nsIScriptError.warningFlag;
case "error":
- var scriptError = Components.classes["@mozilla.org/scripterror;1"]
- .createInstance(nsIScriptError);
+ var scriptError = Cc["@mozilla.org/scripterror;1"]
+ .createInstance(nsIScriptError);
scriptError.initWithWindowID(Array.from(aEvent.arguments),
aEvent.filename, "", aEvent.lineNumber, 0,
flg, "content javascript", aEvent.innerID);
Services.console.logMessage(scriptError);
break;
case "log":
case "info":
Services.console.logStringMessage(Array.from(aEvent.arguments));
@@ -226,32 +226,32 @@ SuiteGlue.prototype = {
this._onProfileAfterChange();
break;
case "final-ui-startup":
this._onProfileStartup();
this._promptForMasterPassword();
this._checkForNewAddons();
Services.search.init();
listeners.init();
- Components.classes["@mozilla.org/globalmessagemanager;1"]
- .getService(Components.interfaces.nsIMessageListenerManager)
- .loadFrameScript("chrome://navigator/content/content.js", true);
+ Cc["@mozilla.org/globalmessagemanager;1"]
+ .getService(Ci.nsIMessageListenerManager)
+ .loadFrameScript("chrome://navigator/content/content.js", true);
ChromeUtils.import("resource://gre/modules/NotificationDB.jsm");
ChromeUtils.import("resource://gre/modules/Downloads.jsm");
ChromeUtils.import("resource://gre/modules/DownloadIntegration.jsm");
DownloadIntegration.shouldPersistDownload = function() { return true; }
Downloads.getList(Downloads.ALL).then(list => list.addView(this))
.then(() => gDownloadsLoaded = true);
if ("@mozilla.org/widget/macdocksupport;1" in Components.classes)
- gTaskbarProgress = Components.classes["@mozilla.org/widget/macdocksupport;1"]
- .getService(Components.interfaces.nsITaskbarProgress);
+ gTaskbarProgress = Cc["@mozilla.org/widget/macdocksupport;1"]
+ .getService(Ci.nsITaskbarProgress);
else if ("@mozilla.org/windows-taskbar;1" in Components.classes) {
- gWinTaskbar = Components.classes["@mozilla.org/windows-taskbar;1"]
- .getService(Components.interfaces.nsIWinTaskbar);
+ gWinTaskbar = Cc["@mozilla.org/windows-taskbar;1"]
+ .getService(Ci.nsIWinTaskbar);
if (!gWinTaskbar.available) {
gWinTaskbar = null;
break;
}
} else {
break;
}
Downloads.getSummary(Downloads.PUBLIC).then(list => {
@@ -294,17 +294,17 @@ SuiteGlue.prototype = {
// case "weave:service:ready":
// this._setSyncAutoconnectDelay();
// break;
// case "weave:engine:clients:display-uri":
// this._onDisplaySyncURI(subject);
// break;
case "session-save":
this._setPrefToSaveSession();
- subject.QueryInterface(Components.interfaces.nsISupportsPRBool);
+ subject.QueryInterface(Ci.nsISupportsPRBool);
subject.data = true;
break;
case "dl-done":
this._playDownloadSound();
break;
case "places-init-complete":
if (!this._migrationImportsDefaultBookmarks)
this._initPlaces(false);
@@ -342,17 +342,17 @@ SuiteGlue.prototype = {
case "timer-callback":
// Load the Login Manager data from disk off the main thread, some time
// after startup. If the data is required before the timeout, for example
// because a restored page contains a password field, it will be loaded on
// the main thread, and this initialization request will be ignored.
Services.logins;
break;
case "handle-xul-text-link":
- let linkHandled = subject.QueryInterface(Components.interfaces.nsISupportsPRBool);
+ let linkHandled = subject.QueryInterface(Ci.nsISupportsPRBool);
if (!linkHandled.data) {
let mostRecentBrowserWindow = Services.wm.getMostRecentWindow("navigator:browser");
if (mostRecentBrowserWindow) {
let dataObj = JSON.parse(data);
let where = mostRecentBrowserWindow.whereToOpenLink(dataObj, false, true, true);
// Preserve legacy behavior of non-modifier left-clicks
// opening in a new selected tab.
if (where == "current") {
@@ -365,20 +365,20 @@ SuiteGlue.prototype = {
break;
}
},
// nsIWebProgressListener partial implementation
onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags)
{
if (aWebProgress.isTopLevel &&
- aWebProgress instanceof Components.interfaces.nsIDocShell &&
- aWebProgress.loadType & Components.interfaces.nsIDocShell.LOAD_CMD_NORMAL &&
+ aWebProgress instanceof Ci.nsIDocShell &&
+ aWebProgress.loadType & Ci.nsIDocShell.LOAD_CMD_NORMAL &&
aWebProgress.useGlobalHistory &&
- aWebProgress instanceof Components.interfaces.nsILoadContext &&
+ aWebProgress instanceof Ci.nsILoadContext &&
!aWebProgress.usePrivateBrowsing) {
switch (aLocation.scheme) {
case "about":
case "imap":
case "news":
case "mailbox":
case "moz-anno":
case "view-source":
@@ -416,19 +416,19 @@ SuiteGlue.prototype = {
Services.obs.addObserver(this, "dl-done", true);
Services.obs.addObserver(this, "places-init-complete", true);
Services.obs.addObserver(this, "places-database-locked", true);
Services.obs.addObserver(this, "places-shutdown", true);
Services.obs.addObserver(this, "browser-search-engine-modified", true);
Services.obs.addObserver(this, "notifications-open-settings", true);
Services.prefs.addObserver("devtools.debugger.", this, true);
Services.obs.addObserver(this, "handle-xul-text-link", true);
- Components.classes['@mozilla.org/docloaderservice;1']
- .getService(Components.interfaces.nsIWebProgress)
- .addProgressListener(this, Components.interfaces.nsIWebProgress.NOTIFY_LOCATION);
+ Cc['@mozilla.org/docloaderservice;1']
+ .getService(Ci.nsIWebProgress)
+ .addProgressListener(this, Ci.nsIWebProgress.NOTIFY_LOCATION);
},
// profile is available
_onProfileAfterChange: function()
{
// check if we're in safe mode
if (Services.appinfo.inSafeMode) {
Services.ww.openWindow(null, "chrome://communicator/content/safeMode.xul",
@@ -448,18 +448,18 @@ SuiteGlue.prototype = {
if (Services.prefs.prefHasUserValue("privacy.sanitize.didShutdownSanitize")) {
Services.prefs.clearUserPref("privacy.sanitize.didShutdownSanitize");
// We need to persist this preference change, since we want to
// check it at next app start even if the browser exits abruptly
Services.prefs.savePrefFile(null);
}
- var timer = Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ var timer = Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
timer.init(this, 3000, timer.TYPE_ONE_SHOT);
},
_migrateUI: function()
{
const UI_VERSION = 3;
// If the pref is not set this is a new or pre SeaMonkey 2.49 profile.
@@ -476,17 +476,17 @@ SuiteGlue.prototype = {
if (currentUIVersion < 1) {
// Run any migrations due prior to 2.49.
this._updatePrefs();
this._migrateDownloadPrefs();
// Migrate remote content exceptions for email addresses which are
// encoded as chrome URIs.
let permissionsDB =
- Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ Services.dirsvc.get("ProfD", Ci.nsIFile);
permissionsDB.append("permissions.sqlite");
let db = Services.storage.openDatabase(permissionsDB);
try {
let statement = db.createStatement(
"select origin, permission from moz_perms where " +
// Avoid 'like' here which needs to be escaped.
" substr(origin, 1, 28) = 'chrome://messenger/content/?';");
@@ -504,17 +504,17 @@ SuiteGlue.prototype = {
Services.io.newURI(origin), "image", permission);
}
} finally {
statement.finalize();
}
// Sadly we still need to clear the database manually. Experiments
// showed that the permissions manager deletes only one record.
- db.beginTransactionAs(Components.interfaces.mozIStorageConnection.TRANSACTION_EXCLUSIVE);
+ db.beginTransactionAs(Ci.mozIStorageConnection.TRANSACTION_EXCLUSIVE);
try {
db.executeSimpleSQL("delete from moz_perms where " +
" substr(origin, 1, 28) = 'chrome://messenger/content/?';");
db.commitTransaction();
} catch (ex) {
db.rollbackTransaction();
throw ex;
@@ -549,64 +549,64 @@ SuiteGlue.prototype = {
},
// Copies additional profile files from the default profile tho the current profile.
// Only files not covered by the regular profile creation process.
// Currently only the userchrome examples.
_copyDefaultProfileFiles: function()
{
// Copy default chrome example files if they do not exist in the current profile.
- var profileDir = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ var profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
profileDir.append("chrome");
// The chrome directory in the current/new profile already exists so no copying.
if (profileDir.exists())
return;
let defaultProfileDir = Services.dirsvc.get("DefRt",
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
defaultProfileDir.append("profile");
defaultProfileDir.append("chrome");
if (defaultProfileDir.exists() && defaultProfileDir.isDirectory()) {
try {
this._copyDir(defaultProfileDir, profileDir);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
},
// Simple copy function for copying complete aSource Directory to aDestiniation.
_copyDir: function(aSource, aDestination)
{
let enumerator = aSource.directoryEntries;
while (enumerator.hasMoreElements()) {
- let file = enumerator.getNext().QueryInterface(Components.interfaces.nsIFile);
+ let file = enumerator.getNext().QueryInterface(Ci.nsIFile);
if (file.isDirectory()) {
let subdir = aDestination.clone();
subdir.append(file.leafName);
// Create the target directory. If it already exists continue copying files.
try {
- subdir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE,
+ subdir.create(Ci.nsIFile.DIRECTORY_TYPE,
FileUtils.PERMS_DIRECTORY);
} catch (ex) {
- if (ex.result != Components.results.NS_ERROR_FILE_ALREADY_EXISTS)
+ if (ex.result != Cr.NS_ERROR_FILE_ALREADY_EXISTS)
throw ex;
}
// Directory created. Now copy the files.
this._copyDir(file, subdir);
} else {
try {
file.copyTo(aDestination, null);
} catch (e) {
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
}
},
// Browser startup complete. All initial windows have opened.
_onBrowserStartup: function(aWindow)
{
@@ -633,18 +633,18 @@ SuiteGlue.prototype = {
var notifyBox = browser.getNotificationBox();
// Show about:rights notification, if needed.
if (this._shouldShowRights())
this._showRightsNotification(notifyBox);
if ("@mozilla.org/windows-taskbar;1" in Components.classes &&
- Components.classes["@mozilla.org/windows-taskbar;1"]
- .getService(Components.interfaces.nsIWinTaskbar).available) {
+ Cc["@mozilla.org/windows-taskbar;1"]
+ .getService(Ci.nsIWinTaskbar).available) {
let temp = {};
ChromeUtils.import("resource:///modules/WindowsJumpLists.jsm", temp);
temp.WinTaskbarJumpList.startup();
}
// Load the "more info" page for a locked places.sqlite
// This property is set earlier by places-database-locked topic.
if (this._isPlacesDatabaseLocked)
@@ -668,19 +668,19 @@ SuiteGlue.prototype = {
_promptForMasterPassword: function()
{
if (!Services.prefs.getBoolPref("signon.startup.prompt"))
return;
// Try to avoid the multiple master password prompts on startup scenario
// by prompting for the master password upfront.
- let token = Components.classes["@mozilla.org/security/pk11tokendb;1"]
- .getService(Components.interfaces.nsIPK11TokenDB)
- .getInternalKeyToken();
+ let token = Cc["@mozilla.org/security/pk11tokendb;1"]
+ .getService(Ci.nsIPK11TokenDB)
+ .getInternalKeyToken();
// Only log in to the internal token if it is already initialized,
// otherwise we get a "Change Master Password" dialog.
try {
if (!token.needsUserInit)
token.login(false);
} catch (ex) {
// If user cancels an exception is expected.
@@ -690,39 +690,39 @@ SuiteGlue.prototype = {
// If new add-ons were installed during startup, open the add-ons manager.
_checkForNewAddons: function()
{
const PREF_EM_NEW_ADDONS_LIST = "extensions.newAddons";
if (!Services.prefs.prefHasUserValue(PREF_EM_NEW_ADDONS_LIST))
return;
- const args = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
- let str = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ const args = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
+ let str = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
args.appendElement(str);
- str = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ str = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
str.data = Services.prefs.getCharPref(PREF_EM_NEW_ADDONS_LIST);
args.appendElement(str);
const EMURL = "chrome://mozapps/content/extensions/extensions.xul";
// This window is the "first" to open.
// 'alwaysRaised' makes sure it stays in the foreground (though unfocused)
// so it is noticed.
const EMFEATURES = "all,dialog=no,alwaysRaised";
Services.ww.openWindow(null, EMURL, "_blank", EMFEATURES, args);
Services.prefs.clearUserPref(PREF_EM_NEW_ADDONS_LIST);
},
_onQuitRequest: function(aCancelQuit, aQuitType)
{
// If user has already dismissed quit request, then do nothing
- if ((aCancelQuit instanceof Components.interfaces.nsISupportsPRBool) && aCancelQuit.data)
+ if ((aCancelQuit instanceof Ci.nsISupportsPRBool) && aCancelQuit.data)
return;
var windowcount = 0;
var pagecount = 0;
var browserEnum = Services.wm.getEnumerator("navigator:browser");
while (browserEnum.hasMoreElements()) {
windowcount++;
@@ -798,17 +798,17 @@ SuiteGlue.prototype = {
neverAskText, neverAsk);
switch (buttonChoice) {
case 2:
if (neverAsk.value)
Services.prefs.setBoolPref("browser.tabs.warnOnClose", false);
break;
case 1:
- aCancelQuit.QueryInterface(Components.interfaces.nsISupportsPRBool);
+ aCancelQuit.QueryInterface(Ci.nsISupportsPRBool);
aCancelQuit.data = true;
break;
case 0:
this._saveSession = true;
if (neverAsk.value) {
if (aQuitType == "restart")
Services.prefs.setBoolPref("browser.warnOnRestart", false);
else {
@@ -820,21 +820,21 @@ SuiteGlue.prototype = {
}
}
},
_playDownloadSound: function()
{
if (Services.prefs.getBoolPref("browser.download.finished_download_sound")) {
if (!this._sound)
- this._sound = Components.classes["@mozilla.org/sound;1"]
- .createInstance(Components.interfaces.nsISound);
+ this._sound = Cc["@mozilla.org/sound;1"]
+ .createInstance(Ci.nsISound);
try {
var url = Services.prefs.getComplexValue("browser.download.finished_sound_url",
- Components.interfaces.nsISupportsString);
+ Ci.nsISupportsString);
this._sound.play(Services.io.newURI(url.data));
} catch (e) {
this._sound.beep();
}
}
},
_showPluginUpdatePage: function(aWindow) {
@@ -916,20 +916,20 @@ SuiteGlue.prototype = {
},
// This method gets the shell service and has it check its settings.
// This will do nothing on platforms without a shell service.
_checkForDefaultClient: function checkForDefaultClient(aWindow)
{
const NS_SHELLSERVICE_CID = "@mozilla.org/suite/shell-service;1";
if (NS_SHELLSERVICE_CID in Components.classes) try {
- var nsIShellService = Components.interfaces.nsIShellService;
+ var nsIShellService = Ci.nsIShellService;
- var shellService = Components.classes[NS_SHELLSERVICE_CID]
- .getService(nsIShellService);
+ var shellService = Cc[NS_SHELLSERVICE_CID]
+ .getService(nsIShellService);
var appTypes = shellService.shouldBeDefaultClientFor;
// Show the default client dialog only if we should check for the default
// client and we aren't already the default for the stored app types in
// shell.checkDefaultApps.
if (appTypes && shellService.shouldCheckDefaultClient &&
!shellService.isDefaultClient(true, appTypes)) {
aWindow.openDialog("chrome://communicator/content/defaultClientDialog.xul",
@@ -1006,17 +1006,17 @@ SuiteGlue.prototype = {
importBookmarks = false;
}
else if (dbStatus == PlacesUtils.history.DATABASE_STATUS_OK) {
importBookmarks = false;
}
else {
// We have created a new database but we don't have any backup available.
importBookmarks = true;
- var bookmarksHTMLFile = Services.dirsvc.get("BMarks", Components.interfaces.nsIFile);
+ var bookmarksHTMLFile = Services.dirsvc.get("BMarks", Ci.nsIFile);
if (bookmarksHTMLFile.exists()) {
// If bookmarks.html is available in current profile import it...
importBookmarksHTML = true;
}
else {
// ...otherwise we will restore defaults.
restoreDefaultBookmarks = true;
}
@@ -1048,40 +1048,40 @@ SuiteGlue.prototype = {
var bookmarksURI = null;
if (restoreDefaultBookmarks) {
// User wants to restore bookmarks.html file from default profile folder.
bookmarksURI = Services.io.newURI("resource:///defaults/profile/bookmarks.html");
}
else {
// Get bookmarks.html file location.
- var bookmarksFile = Services.dirsvc.get("BMarks", Components.interfaces.nsIFile);
+ var bookmarksFile = Services.dirsvc.get("BMarks", Ci.nsIFile);
if (bookmarksFile.exists())
bookmarksURI = Services.io.newFileURI(bookmarksFile);
}
if (bookmarksURI) {
// Import from bookmarks.html file.
try {
BookmarkHTMLUtils.importFromURL(bookmarksURI.spec, true).then(null,
function onFailure() {
- Components.utils.reportError("Bookmarks.html file could be corrupt.");
+ Cu.reportError("Bookmarks.html file could be corrupt.");
}
).then(
// Ensure that smart bookmarks are created once the operation is
// complete.
this.ensurePlacesDefaultQueriesInitialized.bind(this)
);
}
catch(ex) {
- Components.utils.reportError("bookmarks.html file could be corrupt. " + ex);
+ Cu.reportError("bookmarks.html file could be corrupt. " + ex);
}
}
else {
- Components.utils.reportError("Unable to find bookmarks.html file.");
+ Cu.reportError("Unable to find bookmarks.html file.");
}
// Reset preferences, so we won't try to import again at next run.
if (importBookmarksHTML)
Services.prefs.setBoolPref("browser.places.importBookmarksHTML", false);
if (restoreDefaultBookmarks)
Services.prefs.setBoolPref("browser.bookmarks.restore_default_bookmarks",
false);
@@ -1115,17 +1115,17 @@ SuiteGlue.prototype = {
if (Services.prefs.getBoolPref("browser.bookmarks.autoExportHTML")) {
// Exceptionally, since this is a non-default setting and HTML format is
// discouraged in favor of the JSON backups, we spin the event loop on
// shutdown, to wait for the export to finish. We cannot safely spin
// the event loop on shutdown until we include a watchdog to prevent
// potential hangs (bug 518683). The asynchronous shutdown operations
// will then be handled by a shutdown service (bug 435058).
var shutdownComplete = false;
- BookmarkHTMLUtils.exportToFile(Services.dirsvc.get("BMarks", Components.interfaces.nsIFile)).then(
+ BookmarkHTMLUtils.exportToFile(Services.dirsvc.get("BMarks", Ci.nsIFile)).then(
function onSuccess() {
shutdownComplete = true;
},
function onFailure() {
// There is no point in reporting errors since we are shutting down.
shutdownComplete = true;
}
);
@@ -1189,18 +1189,18 @@ SuiteGlue.prototype = {
} catch (ex) {}
// replace underscore with dash if found in language
if (/_/.test(prefValue)) {
prefValue = prefValue.replace(/_/g, "-");
Services.prefs.setCharPref(prefName, prefValue);
}
- var spellChecker = Components.classes["@mozilla.org/spellchecker/engine;1"]
- .getService(Components.interfaces.mozISpellCheckingEngine);
+ var spellChecker = Cc["@mozilla.org/spellchecker/engine;1"]
+ .getService(Ci.mozISpellCheckingEngine);
var o1 = {};
spellChecker.getDictionaryList(o1, {});
var dictList = o1.value;
// If the preference contains an invalid dictionary, set it to a valid
// dictionary, any dictionary will do.
if (dictList.length && dictList.indexOf(prefValue) < 0)
Services.prefs.setCharPref(prefName, dictList[0]);
},
@@ -1209,19 +1209,19 @@ SuiteGlue.prototype = {
{
// Migration of download-manager preferences
if (Services.prefs.getPrefType("browser.download.dir") == Services.prefs.PREF_INVALID ||
Services.prefs.getPrefType("browser.download.lastDir") != Services.prefs.PREF_INVALID)
return; //Do nothing if .dir does not exist, or if it exists and lastDir does not
try {
Services.prefs.setComplexValue("browser.download.lastDir",
- Components.interfaces.nsIFile,
+ Ci.nsIFile,
Services.prefs.getComplexValue("browser.download.dir",
- Components.interfaces.nsIFile));
+ Ci.nsIFile));
} catch (ex) {
// Ensure that even if we don't end up migrating to a lastDir that we
// don't attempt another update. This will throw when QI'ed to
// nsIFile, but it does fallback gracefully.
Services.prefs.setCharPref("browser.download.lastDir", "");
}
try {
@@ -1307,17 +1307,17 @@ SuiteGlue.prototype = {
{ wrappedJSObject: aDownload });
break;
}
return; // No UI for behavior >= 2
},
onDownloadChanged: function(aDownload) {
- const nsIDownloadManager = Components.interfaces.nsIDownloadManager;
+ const nsIDownloadManager = Ci.nsIDownloadManager;
aDownload.state =
!aDownload.stopped ? nsIDownloadManager.DOWNLOAD_DOWNLOADING :
aDownload.succeeded ? nsIDownloadManager.DOWNLOAD_FINISHED :
aDownload.error ? aDownload.error.becauseBlocked ?
nsIDownloadManager.DOWNLOAD_BLOCKED_POLICY :
nsIDownloadManager.DOWNLOAD_FAILED :
!aDownload.canceled ? nsIDownloadManager.DOWNLOAD_NOTSTARTED :
aDownload.hasPartialData ? nsIDownloadManager.DOWNLOAD_PAUSED :
@@ -1341,19 +1341,19 @@ SuiteGlue.prototype = {
{ wrappedJSObject: aDownload });
gDownloadManager.addEventListener("load", function() {
gDownloadManager.addEventListener("unload", function() {
gDownloadManager = null;
if (gWinTaskbar)
gTaskbarProgress = null;
});
if (gWinTaskbar) {
- var docShell = gDownloadManager.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell);
+ var docShell = gDownloadManager.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell);
gTaskbarProgress = gWinTaskbar.getTaskbarProgress(docShell);
onSummaryChanged();
}
});
} else if (!aDownload ||
Services.prefs.getBoolPref(PREF_FOCUS_WHEN_STARTING)) {
gDownloadManager.focus();
} else {
@@ -1405,44 +1405,44 @@ SuiteGlue.prototype = {
let menuIndex = 0;
let toolbarIndex = 0;
let bundle = Services.strings.createBundle("chrome://communicator/locale/places/places.properties");
let smartBookmarks = {
MostVisited: {
title: bundle.GetStringFromName("mostVisitedTitle"),
uri: NetUtil.newURI("place:sort=" +
- Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING +
+ Ci.nsINavHistoryQueryOptions.SORT_BY_VISITCOUNT_DESCENDING +
"&maxResults=" + MAX_RESULTS),
parent: PlacesUtils.toolbarFolderId,
position: toolbarIndex++,
newInVersion: 1
},
RecentlyBookmarked: {
title: bundle.GetStringFromName("recentlyBookmarkedTitle"),
uri: NetUtil.newURI("place:folder=BOOKMARKS_MENU" +
"&folder=UNFILED_BOOKMARKS" +
"&folder=TOOLBAR" +
"&queryType=" +
- Components.interfaces.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
+ Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
"&sort=" +
- Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING +
+ Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING +
"&maxResults=" + MAX_RESULTS +
"&excludeQueries=1"),
parent: PlacesUtils.bookmarksMenuFolderId,
position: menuIndex++,
newInVersion: 1
},
RecentTags: {
title: bundle.GetStringFromName("recentTagsTitle"),
uri: NetUtil.newURI("place:"+
"type=" +
- Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY +
+ Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY +
"&sort=" +
- Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_DESCENDING +
+ Ci.nsINavHistoryQueryOptions.SORT_BY_LASTMODIFIED_DESCENDING +
"&maxResults=" + MAX_RESULTS),
parent: PlacesUtils.bookmarksMenuFolderId,
position: menuIndex++,
newInVersion: 1
}
};
// Set current itemId, parent and position if Smart Bookmark exists,
@@ -1508,17 +1508,17 @@ SuiteGlue.prototype = {
}
}
};
try {
PlacesUtils.bookmarks.runInBatchMode(batch, null);
}
catch(ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
}
finally {
Services.prefs.setIntPref(SMART_BOOKMARKS_PREF, SMART_BOOKMARKS_VERSION);
Services.prefs.savePrefFile(null);
}
},
/**
@@ -1527,66 +1527,66 @@ SuiteGlue.prototype = {
_onDisplaySyncURI: function _onDisplaySyncURI(data) {
try {
var url = data.wrappedJSObject.object.uri;
var mostRecentBrowserWindow = Services.wm.getMostRecentWindow("navigator:browser");
if (mostRecentBrowserWindow) {
mostRecentBrowserWindow.getBrowser().addTab(url, { focusNewTab: true });
mostRecentBrowserWindow.content.focus();
} else {
- var args = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ var args = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
args.data = url;
var chromeURL = Services.prefs.getCharPref("browser.chromeURL");
Services.ww.openWindow(null, chromeURL, "_blank", "chrome,all,dialog=no", args);
}
} catch (e) {
- Components.utils.reportError("Error displaying tab received by Sync: " + e);
+ Cu.reportError("Error displaying tab received by Sync: " + e);
}
},
// for XPCOM
classID: Components.ID("{bbbbe845-5a1b-40ee-813c-f84b8faaa07c}"),
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
- Components.interfaces.nsIWebProgressListener,
- Components.interfaces.nsISupportsWeakReference,
- Components.interfaces.nsISuiteGlue])
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
+ Ci.nsIWebProgressListener,
+ Ci.nsISupportsWeakReference,
+ Ci.nsISuiteGlue])
}
function ContentPermissionPrompt() {}
ContentPermissionPrompt.prototype = {
classID: Components.ID("{9d4c845d-3f09-402a-b66d-50f291d7d50f}"),
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIContentPermissionPrompt]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionPrompt]),
prompt: function(aRequest)
{
// Only allow exactly one permission type here.
if (aRequest.types.length != 1)
return;
const kFeatureKeys = { "geolocation" : "geo",
"desktop-notification" : "desktop-notification",
};
// Make sure that we support the request.
- var type = aRequest.types.queryElementAt(0, Components.interfaces.nsIContentPermissionType).type;
+ var type = aRequest.types.queryElementAt(0, Ci.nsIContentPermissionType).type;
if (!(type in kFeatureKeys))
return;
var path, host;
var requestingPrincipal = aRequest.principal;
var requestingURI = requestingPrincipal.URI;
- if (requestingURI instanceof Components.interfaces.nsIFileURL)
+ if (requestingURI instanceof Ci.nsIFileURL)
path = requestingURI.file.path;
- else if (requestingURI instanceof Components.interfaces.nsIStandardURL)
+ else if (requestingURI instanceof Ci.nsIStandardURL)
host = requestingURI.host;
// Ignore requests from non-nsIStandardURLs
else
return;
var perm = kFeatureKeys[type];
switch (Services.perms.testExactPermissionFromPrincipal(requestingPrincipal, perm)) {
case Services.perms.ALLOW_ACTION:
@@ -1609,19 +1609,19 @@ ContentPermissionPrompt.prototype = {
if (remember)
Services.perms.addFromPrincipal(requestingPrincipal, perm,
Services.perms.DENY_ACTION,
expireType);
aRequest.cancel();
}
var nb = aRequest.window
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.parentNode;
// Show the prompt.
switch (type) {
case "geolocation":
nb.showGeolocationPrompt(path, host, allowCallback, cancelCallback);
break;
case "desktop-notification":
--- a/suite/common/sync/syncGenericChange.js
+++ b/suite/common/sync/syncGenericChange.js
@@ -223,13 +223,13 @@ var Change = {
this._statusRow.hidden = valid;
this._dialog.getButton("finish").disabled = !valid;
},
_str: function Change__string(str) {
try {
return this._stringBundle.GetStringFromName(str);
} catch (e) {
- Components.utils.reportError("Missing string: " + str);
+ Cu.reportError("Missing string: " + str);
throw e;
}
}
};
--- a/suite/common/sync/syncUI.js
+++ b/suite/common/sync/syncUI.js
@@ -22,18 +22,18 @@ var gSyncUI = {
init: function SUI_init() {
// Update the Tools menu according to whether Sync is set up or not.
let taskPopup = document.getElementById("taskPopup");
if (taskPopup)
taskPopup.addEventListener("popupshowing", this.updateUI.bind(this));
// Proceed to set up the UI if Sync has already started up.
// Otherwise we'll do it when Sync is firing up.
- if (Components.classes["@mozilla.org/weave/service;1"]
- .getService().wrappedJSObject.ready) {
+ if (Cc["@mozilla.org/weave/service;1"]
+ .getService().wrappedJSObject.ready) {
this.initUI();
return;
}
Services.obs.addObserver(this, "weave:service:ready", true);
// Remove the observer if the window is closed before the observer
// was triggered.
@@ -437,20 +437,20 @@ var gSyncUI = {
break;
case "weave:ui:clear-error":
this.clearError();
break;
}
},
QueryInterface: XPCOMUtils.generateQI([
- Components.interfaces.nsIObserver,
- Components.interfaces.nsISupportsWeakReference
+ Ci.nsIObserver,
+ Ci.nsISupportsWeakReference
])
};
XPCOMUtils.defineLazyGetter(gSyncUI, "_stringBundle", function() {
//XXXzpao these strings should probably be moved from /services to /browser... (bug 583381)
// but for now just make it work
- return Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle("chrome://weave/locale/services/sync.properties");
+ return Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle("chrome://weave/locale/services/sync.properties");
});
--- a/suite/common/sync/syncUtils.js
+++ b/suite/common/sync/syncUtils.js
@@ -213,12 +213,12 @@ var gSyncUtils = {
}
let errorString = error ? Weave.Utils.getErrorString(error) : "";
return [valid, errorString];
}
};
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGetter(gSyncUtils, "_stringBundle", function() {
- return Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle("chrome://communicator/locale/sync/syncSetup.properties");
+ return Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle("chrome://communicator/locale/sync/syncSetup.properties");
});
--- a/suite/common/tasksOverlay.js
+++ b/suite/common/tasksOverlay.js
@@ -9,32 +9,32 @@ function toNavigator()
{
if (!CycleWindow("navigator:browser"))
OpenBrowserWindow();
}
function ExpirePassword()
{
// Queries the HTTP Auth Manager and clears all sessions
- Components.classes['@mozilla.org/network/http-auth-manager;1']
- .getService(Components.interfaces.nsIHttpAuthManager)
- .clearAll();
+ Cc['@mozilla.org/network/http-auth-manager;1']
+ .getService(Ci.nsIHttpAuthManager)
+ .clearAll();
// Expires the master password
- Components.classes["@mozilla.org/security/pk11tokendb;1"]
- .createInstance(Components.interfaces.nsIPK11TokenDB)
- .getInternalKeyToken()
- .checkPassword("");
+ Cc["@mozilla.org/security/pk11tokendb;1"]
+ .createInstance(Ci.nsIPK11TokenDB)
+ .getInternalKeyToken()
+ .checkPassword("");
}
function toDownloadManager()
{
- Components.classes["@mozilla.org/suite/suiteglue;1"]
- .getService(Components.interfaces.nsISuiteGlue)
- .showDownloadManager();
+ Cc["@mozilla.org/suite/suiteglue;1"]
+ .getService(Ci.nsISuiteGlue)
+ .showDownloadManager();
}
function toDataManager(aView)
{
var useDlg = Services.prefs.getBoolPref("suite.manager.dataman.openAsDialog");
if (useDlg) {
var url = "chrome://communicator/content/dataman/dataman.xul";
@@ -161,19 +161,19 @@ function OpenBrowserWindow()
return flag == "remote" ? "xfeDoCommand(openBrowser)" : null;
},
handleFlag: function handleFlag(flag, caseSensitive) {
return false;
},
preventDefault: true
};
const clh_prefix = "@mozilla.org/commandlinehandler/general-startup;1";
- Components.classes[clh_prefix + "?type=browser"]
- .getService(Components.interfaces.nsICommandLineHandler)
- .handle(cmdLine);
+ Cc[clh_prefix + "?type=browser"]
+ .getService(Ci.nsICommandLineHandler)
+ .handle(cmdLine);
return null;
}
function CycleWindow( aType )
{
var topWindowOfType = Services.wm.getMostRecentWindow(aType);
var topWindow = Services.wm.getMostRecentWindow(null);
@@ -240,18 +240,18 @@ function checkFocusedWindow()
}
function toProfileManager()
{
var promgrWin = Services.wm.getMostRecentWindow("mozilla:profileSelection");
if (promgrWin) {
promgrWin.focus();
} else {
- var params = Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
- .createInstance(Components.interfaces.nsIDialogParamBlock);
+ var params = Cc["@mozilla.org/embedcomp/dialogparam;1"]
+ .createInstance(Ci.nsIDialogParamBlock);
params.SetNumberStrings(1);
params.SetString(0, "menu");
window.openDialog("chrome://communicator/content/profile/profileSelection.xul",
"",
"centerscreen,chrome,titlebar,resizable",
params);
}
--- a/suite/common/tests/browser/browser_346337.js
+++ b/suite/common/tests/browser/browser_346337.js
@@ -1,23 +1,23 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function test() {
/** Test for Bug 346337 **/
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append("346337_test1.file");
let filePath1 = file.path;
- file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append("346337_test2.file");
let filePath2 = file.path;
let fieldList = {
"//input[@name='input']": Date.now().toString(),
"//input[@name='spaced 1']": Math.random().toString(),
"//input[3]": "three",
"//input[@type='checkbox']": true,
@@ -43,28 +43,28 @@ function test() {
function setFormValue(aTab, aQuery, aValue) {
let node = getElementByXPath(aTab, aQuery);
if (typeof aValue == "string")
node.value = aValue;
else if (typeof aValue == "boolean")
node.checked = aValue;
else if (typeof aValue == "number")
node.selectedIndex = aValue;
- else if (node instanceof Components.interfaces.nsIDOMHTMLInputElement && node.type == "file")
+ else if (node instanceof Ci.nsIDOMHTMLInputElement && node.type == "file")
node.mozSetFileNameArray(aValue, aValue.length);
else
Array.from(node.options).forEach((aOpt, aIx) =>
aOpt.selected = aValue.includes(aIx));
}
function compareFormValue(aTab, aQuery, aValue) {
let node = getElementByXPath(aTab, aQuery);
if (!node)
return false;
- if (node instanceof Components.interfaces.nsIDOMHTMLInputElement) {
+ if (node instanceof Ci.nsIDOMHTMLInputElement) {
if (node.type == "file") {
let fileNames = node.mozGetFileNameArray();
return fileNames.length == aValue.length &&
Array.from(fileNames).every(aFile => aValue.includes(aFile));
}
return aValue == (node.type == "checkbox" || node.type == "radio" ?
node.checked : node.value);
}
--- a/suite/common/tests/browser/browser_354894.js
+++ b/suite/common/tests/browser/browser_354894.js
@@ -66,19 +66,19 @@ function browserWindowsCount(expected, m
expected = [expected, expected];
let count = 0;
let e = Services.wm.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
is(count, expected[0], msg + " (nsIWindowMediator)");
- let state = Components.classes["@mozilla.org/suite/sessionstore;1"]
- .getService(Components.interfaces.nsISessionStore)
- .getBrowserState();
+ let state = Cc["@mozilla.org/suite/sessionstore;1"]
+ .getService(Ci.nsISessionStore)
+ .getBrowserState();
is(JSON.parse(state).windows.length, expected[1], msg + " (getBrowserState)");
}
function test() {
browserWindowsCount(1, "Only one browser window should be open initially");
if (navigator.platform.match(/Mac/)) {
todo(false, "Test disabled on MacOSX. (Bug 520787)");
@@ -125,17 +125,17 @@ function test() {
observe: function(aCancel, aTopic, aData) {
// count so that we later may compare
observing[aTopic]++;
// handle some tests
if (++this.hitCount == 1) {
// Test 6
- aCancel.QueryInterface(Components.interfaces.nsISupportsPRBool).data = true;
+ aCancel.QueryInterface(Ci.nsISupportsPRBool).data = true;
}
}
};
/**
* Helper: Sets prefs as the testsuite requires
* @note Will be reset in cleanTestSuite just before finishing the tests
*/
--- a/suite/common/tests/browser/browser_423132.js
+++ b/suite/common/tests/browser/browser_423132.js
@@ -16,17 +16,17 @@ function browserWindowsCount() {
function test() {
// test that cookies are stored and restored correctly by sessionstore,
// bug 423132, ported by bug 524371.
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
waitForExplicitFinish();
- let cs = Components.classes["@mozilla.org/cookiemanager;1"].getService(Components.interfaces.nsICookieManager);
+ let cs = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager);
cs.removeAll();
// make sure that sessionstore.js can be forced to be created by setting
// the interval pref to 0
Services.prefs.setIntPref("browser.sessionstore.interval", 0);
const testURL = "http://mochi.test:8888/browser/" +
"suite/common/tests/browser/browser_423132_sample.html";
@@ -46,32 +46,32 @@ function test() {
// get the sessionstore state for the window
let state = ss.getWindowState(newWin);
// verify our cookie got set during pageload
let e = cs.enumerator;
let cookie;
let i = 0;
while (e.hasMoreElements()) {
- cookie = e.getNext().QueryInterface(Components.interfaces.nsICookie);
+ cookie = e.getNext().QueryInterface(Ci.nsICookie);
i++;
}
is(i, 1, "expected one cookie");
// remove the cookie
cs.removeAll();
// restore the window state
ss.setWindowState(newWin, state, true);
// at this point, the cookie should be restored...
e = cs.enumerator;
let cookie2;
while (e.hasMoreElements()) {
- cookie2 = e.getNext().QueryInterface(Components.interfaces.nsICookie);
+ cookie2 = e.getNext().QueryInterface(Ci.nsICookie);
if (cookie.name == cookie2.name)
break;
}
is(cookie.name, cookie2.name, "cookie name successfully restored");
is(cookie.value, cookie2.value, "cookie value successfully restored");
is(cookie.path, cookie2.path, "cookie path successfully restored");
// clean up
--- a/suite/common/tests/browser/browser_466937.js
+++ b/suite/common/tests/browser/browser_466937.js
@@ -2,19 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function test() {
/** Test for Bug 466937 **/
waitForExplicitFinish();
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append("466937_test.file");
let testPath = file.path;
let testURL = "http://mochi.test:8888/browser/" +
"suite/common/tests/browser/browser_466937_sample.html";
let tab = getBrowser().addTab(testURL);
let window = tab.ownerDocument.defaultView;
--- a/suite/common/tests/browser/browser_490040.js
+++ b/suite/common/tests/browser/browser_490040.js
@@ -23,17 +23,17 @@ function test() {
function testWithState(aState) {
// Ensure we can store the window if needed.
let curClosedWindowCount = ss.getClosedWindowCount();
Services.prefs.setIntPref("browser.sessionstore.max_windows_undo",
curClosedWindowCount + 1);
var origWin;
function windowObserver(aSubject, aTopic, aData) {
- let theWin = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
+ let theWin = aSubject.QueryInterface(Ci.nsIDOMWindow);
if (origWin && theWin != origWin)
return;
switch (aTopic) {
case "domwindowopened":
origWin = theWin;
theWin.addEventListener("load", function testTheWinLoad() {
theWin.removeEventListener("load", testTheWinLoad);
--- a/suite/common/tests/browser/browser_586068-cascaded_restore.js
+++ b/suite/common/tests/browser/browser_586068-cascaded_restore.js
@@ -58,19 +58,19 @@ function test_cascade() {
// Set the pref to 1 so we know exactly how many tabs should be restoring at any given time
Services.prefs.setIntPref("browser.sessionstore.max_concurrent_tabs", 1);
// We have our own progress listener for this test, which we'll attach before our state is set
let progressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
dump("\n\nload: " + aBrowser.currentURI.spec + "\n" + JSON.stringify(countTabs()) + "\n\n");
if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW)
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
test_cascade_progressCallback();
}
}
let state = { windows: [{ tabs: [
{ entries: [{ url: "http://example.com" }], extData: { "uniq": r() } },
{ entries: [{ url: "http://example.com" }], extData: { "uniq": r() } },
{ entries: [{ url: "http://example.com" }], extData: { "uniq": r() } },
@@ -119,19 +119,19 @@ function test_select() {
// Set the pref to 0 so we know exactly how many tabs should be restoring at
// any given time. This guarantees that a finishing load won't start another.
Services.prefs.setIntPref("browser.sessionstore.max_concurrent_tabs", 0);
// We have our own progress listener for this test, which we'll attach before our state is set
let progressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW)
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
test_select_progressCallback(aBrowser);
}
}
let state = { windows: [{ tabs: [
{ entries: [{ url: "http://example.org" }], extData: { "uniq": r() } },
{ entries: [{ url: "http://example.org" }], extData: { "uniq": r() } },
{ entries: [{ url: "http://example.org" }], extData: { "uniq": r() } },
@@ -190,19 +190,19 @@ function test_select() {
function test_multiWindowState() {
// We have our own progress listener for this test, which we'll attach before our state is set
let progressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
// We only care about load events when the tab still has
// __SS_restoreState == TAB_STATE_RESTORING on it.
// Since our listener is attached before the sessionstore one, this works out.
if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW)
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
test_multiWindowState_progressCallback(aBrowser);
}
}
// The first window will be put into the already open window and the second
// window will be opened with _openWindowWithState, which is the source of the problem.
let state = { windows: [
{
@@ -242,17 +242,17 @@ function test_multiWindowState() {
// Remove the progress listener from this window, it will be removed from
// theWin when that window is closed (in setBrowserState).
window.getBrowser().removeTabsProgressListener(progressListener);
runNextTest();
}
// We also want to catch the 2nd window, so we need to observe domwindowopened
function windowObserver(aSubject, aTopic, aData) {
- let theWin = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
+ let theWin = aSubject.QueryInterface(Ci.nsIDOMWindow);
if (aTopic == "domwindowopened") {
theWin.addEventListener("load", function theWinLoad() {
theWin.removeEventListener("load", theWinLoad);
Services.ww.unregisterNotification(windowObserver);
theWin.getBrowser().addTabsProgressListener(progressListener);
});
}
@@ -270,19 +270,19 @@ function test_setWindowStateNoOverwrite(
// We have our own progress listener for this test, which we'll attach before our state is set
let progressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
// We only care about load events when the tab still has
// __SS_restoreState == TAB_STATE_RESTORING on it.
// Since our listener is attached before the sessionstore one, this works out.
if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW)
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
test_setWindowStateNoOverwrite_progressCallback(aBrowser);
}
}
// We'll use 2 states so that we can make sure calling setWindowState doesn't
// wipe out currently restoring data.
let state1 = { windows: [{ tabs: [
{ entries: [{ url: "http://example.com#1" }] },
@@ -342,19 +342,19 @@ function test_setWindowStateOverwrite()
// We have our own progress listener for this test, which we'll attach before our state is set
let progressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
// We only care about load events when the tab still has
// __SS_restoreState == TAB_STATE_RESTORING on it.
// Since our listener is attached before the sessionstore one, this works out.
if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW)
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
test_setWindowStateOverwrite_progressCallback(aBrowser);
}
}
// We'll use 2 states so that we can make sure calling setWindowState doesn't
// wipe out currently restoring data.
let state1 = { windows: [{ tabs: [
{ entries: [{ url: "http://example.com#1" }] },
@@ -414,19 +414,19 @@ function test_setBrowserStateInterrupted
// We have our own progress listener for this test, which we'll attach before our state is set
let progressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
// We only care about load events when the tab still has
// __SS_restoreState == TAB_STATE_RESTORING on it.
// Since our listener is attached before the sessionstore one, this works out.
if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW)
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
test_setBrowserStateInterrupted_progressCallback(aBrowser);
}
}
// The first state will be loaded using setBrowserState, followed by the 2nd
// state also being loaded using setBrowserState, interrupting the first restore.
let state1 = { windows: [
{
@@ -505,17 +505,17 @@ function test_setBrowserStateInterrupted
// theWin when that window is closed (in setBrowserState).
window.getBrowser().removeTabsProgressListener(progressListener);
Services.ww.unregisterNotification(windowObserver);
runNextTest();
}
// We also want to catch the extra windows (there should be 2), so we need to observe domwindowopened
function windowObserver(aSubject, aTopic, aData) {
- let theWin = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
+ let theWin = aSubject.QueryInterface(Ci.nsIDOMWindow);
if (aTopic == "domwindowopened") {
theWin.addEventListener("load", function wObserverTheWinLoad() {
theWin.removeEventListener("load", wObserverTheWinLoad);
Services.ww.unregisterNotification(windowObserver);
theWin.getBrowser().addTabsProgressListener(progressListener);
});
}
@@ -531,19 +531,19 @@ function test_reload() {
// Set the pref to 0 so we know exactly how many tabs should be restoring at
// any given time. This guarantees that a finishing load won't start another.
Services.prefs.setIntPref("browser.sessionstore.max_concurrent_tabs", 0);
// We have our own progress listener for this test, which we'll attach before our state is set
let progressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW)
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
test_reload_progressCallback(aBrowser);
}
}
let state = { windows: [{ tabs: [
{ entries: [{ url: "http://example.org/#1" }], extData: { "uniq": r() } },
{ entries: [{ url: "http://example.org/#2" }], extData: { "uniq": r() } },
{ entries: [{ url: "http://example.org/#3" }], extData: { "uniq": r() } },
@@ -603,19 +603,19 @@ function test_reload() {
// This doesn't actually test anything, just does a cascaded restore with default
// settings. This really just sets up to test that reloads work.
function test_reloadCascadeSetup() {
// We have our own progress listener for this test, which we'll attach before our state is set
let progressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW)
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
test_cascadeReloadSetup_progressCallback();
}
}
let state = { windows: [{ tabs: [
{ entries: [{ url: "http://example.com/#1" }], extData: { "uniq": r() } },
{ entries: [{ url: "http://example.com/#2" }], extData: { "uniq": r() } },
{ entries: [{ url: "http://example.com/#3" }], extData: { "uniq": r() } },
@@ -645,19 +645,19 @@ function test_reloadCascadeSetup() {
// This is a generic function that will attempt to reload each test. We do this
// a couple times, so make it utilitarian.
// This test expects that aState contains a single window and that each tab has
// a unique extData value eg. { "uniq": value }.
function _test_reloadAfter(aTestName, aState, aCallback) {
info("starting " + aTestName);
let progressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW)
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
test_reloadAfter_progressCallback(aBrowser);
}
}
// Simulate a left mouse button click with no modifiers, which is what
// Command-R, or clicking reload does.
let fakeEvent = {
button: 0,
--- a/suite/common/tests/browser/browser_607016.js
+++ b/suite/common/tests/browser/browser_607016.js
@@ -24,19 +24,19 @@ function test() {
// any given time. This guarantees that a finishing load won't start another.
Services.prefs.setIntPref("browser.sessionstore.max_concurrent_tabs", 0);
Services.prefs.setIntPref("browser.tabs.max_tabs_undo", 0);
// We have our own progress listener for this test, which we'll attach before our state is set
let progressListener = {
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
if (aBrowser.__SS_restoreState == TAB_STATE_RESTORING &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_WINDOW)
+ aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_WINDOW)
progressCallback(aBrowser);
}
}
let state = { windows: [{ tabs: [
{ entries: [{ url: "http://example.org#1" }], extData: { "uniq": r() } },
{ entries: [{ url: "http://example.org#2" }], extData: { "uniq": r() } }, // overwriting
//{ entries: [{ url: "http://example.org#3" }], extData: { "uniq": r() } }, // hiding
--- a/suite/common/tests/browser/browser_615394-SSWindowState_events.js
+++ b/suite/common/tests/browser/browser_615394-SSWindowState_events.js
@@ -29,18 +29,18 @@ const lameMultiWindowState = { windows:
{ entries: [{ url: "http://example.com#4" }], extData: { "uniq": r() } },
],
selected: 3
}
] };
function getOuterWindowID(aWindow) {
- return aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
- getInterface(Components.interfaces.nsIDOMWindowUtils).outerWindowID;
+ return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
+ getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
}
function test() {
/** Test for Bug 615394 - Session Restore should notify when it is beginning and ending a restore **/
waitForExplicitFinish();
// Preemptively extend the timeout to prevent [orange]
requestLongerTimeout(2);
Services.prefs.setIntPref("browser.tabs.max_tabs_undo", 0);
@@ -256,17 +256,17 @@ function test_setBrowserState() {
let windowEvents = {};
windowEvents[getOuterWindowID(window)] = { busyEventCount: 0, readyEventCount: 0 };
// waitForBrowserState does it's own observing for windows, but doesn't attach
// the listeners we want here, so do it ourselves.
let newWindow;
function windowObserver(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- newWindow = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
+ newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
newWindow.addEventListener("load", function newWindowLoad() {
newWindow.removeEventListener("load", newWindowLoad);
Services.ww.unregisterNotification(windowObserver);
windowEvents[getOuterWindowID(newWindow)] = { busyEventCount: 0, readyEventCount: 0 };
newWindow.addEventListener("SSWindowStateBusy", onSSWindowStateBusy);
@@ -307,17 +307,17 @@ function test_setBrowserState() {
}
function test_undoCloseWindow() {
let newWindow, reopenedWindow;
function firstWindowObserver(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- newWindow = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
+ newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
Services.ww.unregisterNotification(firstWindowObserver);
}
}
Services.ww.registerNotification(firstWindowObserver);
waitForBrowserState(lameMultiWindowState, function() {
// Close the window which isn't window
newWindow.close();
--- a/suite/common/tests/browser/browser_687710_2.js
+++ b/suite/common/tests/browser/browser_687710_2.js
@@ -37,22 +37,22 @@ function test()
compareEntries(i, j, history);
}
}
}
function compareEntries(i, j, history)
{
let e1 = history.getEntryAtIndex(i, false)
- .QueryInterface(Components.interfaces.nsISHEntry)
- .QueryInterface(Components.interfaces.nsISHContainer);
+ .QueryInterface(Ci.nsISHEntry)
+ .QueryInterface(Ci.nsISHContainer);
let e2 = history.getEntryAtIndex(j, false)
- .QueryInterface(Components.interfaces.nsISHEntry)
- .QueryInterface(Components.interfaces.nsISHContainer);
+ .QueryInterface(Ci.nsISHEntry)
+ .QueryInterface(Ci.nsISHContainer);
ok(e1.sharesDocumentWith(e2),
i + ' should share doc with ' + j);
is(e1.childCount, e2.childCount,
'Child count mismatch (' + i + ', ' + j + ')');
for (let c = 0; c < e1.childCount; c++) {
let c1 = e1.GetChildAt(c);
--- a/suite/common/tests/browser/browser_form_restore_events.js
+++ b/suite/common/tests/browser/browser_form_restore_events.js
@@ -2,19 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function test() {
/** Originally a test for Bug 476161, but then expanded to include all input types in bug 640136 **/
waitForExplicitFinish();
- let file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ let file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
let testURL = "http://mochi.test:8888/browser/" +
"suite/common/tests/browser/browser_form_restore_events_sample.html";
let tab = getBrowser().addTab(testURL);
let window = tab.ownerDocument.defaultView;
tab.linkedBrowser.addEventListener("load", function testTabLBLoad(aEvent) {
tab.linkedBrowser.removeEventListener("load", testTabLBLoad, true);
let doc = tab.linkedBrowser.contentDocument;
--- a/suite/common/tests/browser/head.js
+++ b/suite/common/tests/browser/head.js
@@ -1,14 +1,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-var ss = Components.classes["@mozilla.org/suite/sessionstore;1"]
- .getService(Components.interfaces.nsISessionStore);
+var ss = Cc["@mozilla.org/suite/sessionstore;1"]
+ .getService(Ci.nsISessionStore);
function provideWindow(aCallback, aURL, aFeatures) {
function callbackSoon(aWindow) {
executeSoon(function executeCallbackSoon() {
aCallback(aWindow);
});
}
@@ -50,17 +50,17 @@ function waitForBrowserState(aState, aSe
executeSoon(aSetStateCallback);
}
}
// Used to add our listener to further windows so we can catch SSTabRestored
// coming from them when creating a multi-window state.
function windowObserver(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- let newWindow = aSubject.QueryInterface(Components.interfaces.nsIDOMWindow);
+ let newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
newWindow.addEventListener("load", function newWindowLoad() {
newWindow.removeEventListener("load", newWindowLoad);
if (++windowsOpen == expectedWindows) {
Services.ww.unregisterNotification(windowObserver);
windowObserving = false;
}
--- a/suite/common/tests/preferences/browser_bug410900.js
+++ b/suite/common/tests/preferences/browser_bug410900.js
@@ -1,28 +1,28 @@
function test() {
waitForExplicitFinish();
// Setup a phony handler to ensure the app pane will be populated.
- var handler = Components.classes["@mozilla.org/uriloader/web-handler-app;1"]
- .createInstance(Components.interfaces.nsIWebHandlerApp);
+ var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"]
+ .createInstance(Ci.nsIWebHandlerApp);
handler.name = "App pane alive test";
handler.uriTemplate = "http://test.mozilla.org/%s";
- var extps = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ var extps = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
var info = extps.getProtocolHandlerInfo("apppanetest");
info.possibleApplicationHandlers.appendElement(handler);
- var hserv = Components.classes["@mozilla.org/uriloader/handler-service;1"]
- .getService(Components.interfaces.nsIHandlerService);
+ var hserv = Cc["@mozilla.org/uriloader/handler-service;1"]
+ .getService(Ci.nsIHandlerService);
hserv.store(info);
- var obs = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var obs = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
function observer(win, topic, data) {
if (topic != "app-handler-pane-loaded")
return;
obs.removeObserver(observer, "app-handler-pane-loaded");
runTest(win);
}
--- a/suite/common/utilityOverlay.js
+++ b/suite/common/utilityOverlay.js
@@ -27,20 +27,20 @@ ChromeUtils.import("resource://gre/modul
/**
* Go into online/offline mode
**/
const kProxyManual = ["network.proxy.ftp",
"network.proxy.http",
"network.proxy.socks",
"network.proxy.ssl"];
-const kExistingWindow = Components.interfaces.nsIBrowserDOMWindow.OPEN_CURRENTWINDOW;
-const kNewWindow = Components.interfaces.nsIBrowserDOMWindow.OPEN_NEWWINDOW;
-const kNewTab = Components.interfaces.nsIBrowserDOMWindow.OPEN_NEWTAB;
-const kExistingTab = Components.interfaces.nsIBrowserDOMWindow.OPEN_SWITCHTAB;
+const kExistingWindow = Ci.nsIBrowserDOMWindow.OPEN_CURRENTWINDOW;
+const kNewWindow = Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW;
+const kNewTab = Ci.nsIBrowserDOMWindow.OPEN_NEWTAB;
+const kExistingTab = Ci.nsIBrowserDOMWindow.OPEN_SWITCHTAB;
const kNewPrivate = 5;
var TAB_DROP_TYPE = "application/x-moz-tabbrowser-tab";
var gShowBiDi = false;
var gUtilityBundle = null;
var gPrivate = null;
function toggleOfflineStatus()
{
@@ -135,17 +135,17 @@ function setProxyTypeUI()
return;
var onlineTooltip = "onlineTooltip" + GetIntPref("network.proxy.type", 0);
panel.setAttribute("tooltiptext", gUtilityBundle.getString(onlineTooltip));
}
function SetStringPref(aPref, aValue)
{
- const nsISupportsString = Components.interfaces.nsISupportsString;
+ const nsISupportsString = Ci.nsISupportsString;
try {
Services.prefs.setStringPref(aPref, aValue);
} catch (e) {}
}
function GetStringPref(name)
{
try {
@@ -153,46 +153,46 @@ function GetStringPref(name)
} catch (e) {}
return "";
}
function GetLocalizedStringPref(aPrefName, aDefaultValue)
{
try {
return Services.prefs.getComplexValue(aPrefName,
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
} catch (e) {
- Components.utils.reportError("Couldn't get " + aPrefName + " pref: " + e);
+ Cu.reportError("Couldn't get " + aPrefName + " pref: " + e);
}
return aDefaultValue;
}
function GetLocalFilePref(aName)
{
try {
return Services.prefs.getComplexValue(aName,
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
} catch (e) {}
return null;
}
/**
* Returns the Desktop folder.
*/
function GetDesktopFolder()
{
- return Services.dirsvc.get("Desk", Components.interfaces.nsIFile);
+ return Services.dirsvc.get("Desk", Ci.nsIFile);
}
/**
* Returns the relevant nsIFile directory.
*/
function GetSpecialDirectory(aName)
{
- return Services.dirsvc.get(aName, Components.interfaces.nsIFile);
+ return Services.dirsvc.get(aName, Ci.nsIFile);
}
function GetUrlbarHistoryFile()
{
var profileDir = GetSpecialDirectory("ProfD");
profileDir.append("urlbarhistory.sqlite");
return profileDir;
}
@@ -576,25 +576,25 @@ function goClickThrobber(urlPref, aEvent
function getTopWin()
{
return top.gPrivate || Services.wm.getMostRecentWindow("navigator:browser");
}
function isRestricted( url )
{
try {
- const nsIURIFixup = Components.interfaces.nsIURIFixup;
- var uri = Components.classes["@mozilla.org/docshell/urifixup;1"]
- .getService(nsIURIFixup)
- .createFixupURI(url, nsIURIFixup.FIXUP_FLAG_NONE);
+ const nsIURIFixup = Ci.nsIURIFixup;
+ var uri = Cc["@mozilla.org/docshell/urifixup;1"]
+ .getService(nsIURIFixup)
+ .createFixupURI(url, nsIURIFixup.FIXUP_FLAG_NONE);
const URI_INHERITS_SECURITY_CONTEXT =
- Components.interfaces.nsIProtocolHandler.URI_INHERITS_SECURITY_CONTEXT;
- return Components.classes["@mozilla.org/network/util;1"]
- .getService(Components.interfaces.nsINetUtil)
- .URIChainHasFlags(uri, URI_INHERITS_SECURITY_CONTEXT);
+ Ci.nsIProtocolHandler.URI_INHERITS_SECURITY_CONTEXT;
+ return Cc["@mozilla.org/network/util;1"]
+ .getService(Ci.nsINetUtil)
+ .URIChainHasFlags(uri, URI_INHERITS_SECURITY_CONTEXT);
} catch (e) {
return false;
}
}
function openTopWin( url, opener )
{
/* note that this chrome url should probably change to not have
@@ -614,17 +614,17 @@ function openTopWin( url, opener )
if ( topWindowOfType )
{
if (!opener || !isRestricted(url))
topWindowOfType.loadURI(url);
else if (topWindowOfType.content == opener.top)
opener.open(url, "_top");
else
topWindowOfType.getBrowser().loadURIWithFlags(url,
- Components.interfaces.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL);
+ Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL);
topWindowOfType.content.focus();
return topWindowOfType;
}
return window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
}
function goAbout(aProtocol)
@@ -685,29 +685,29 @@ function safeModeRestart()
Services.prompt.BUTTON_TITLE_CANCEL) +
Services.prompt.BUTTON_POS_0_DEFAULT;
var rv = Services.prompt.confirmEx(window, promptTitle, promptMessage,
buttonFlags, restartText, null, null,
checkboxText, checkbox);
if (rv == 0) {
if (checkbox.value)
- Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment)
- .set("MOZ_SAFE_MODE_RESTART", "1");
+ Cc["@mozilla.org/process/environment;1"]
+ .getService(Ci.nsIEnvironment)
+ .set("MOZ_SAFE_MODE_RESTART", "1");
BrowserUtils.restartApplication();
}
}
function checkForUpdates()
{
- var um = Components.classes["@mozilla.org/updates/update-manager;1"]
- .getService(Components.interfaces.nsIUpdateManager);
- var prompter = Components.classes["@mozilla.org/updates/update-prompt;1"]
- .createInstance(Components.interfaces.nsIUpdatePrompt);
+ var um = Cc["@mozilla.org/updates/update-manager;1"]
+ .getService(Ci.nsIUpdateManager);
+ var prompter = Cc["@mozilla.org/updates/update-prompt;1"]
+ .createInstance(Ci.nsIUpdatePrompt);
// If there's an update ready to be applied, show the "Update Downloaded"
// UI instead and let the user know they have to restart the browser for
// the changes to be applied.
if (um.activeUpdate && um.activeUpdate.state == "pending")
prompter.showUpdateDownloaded(um.activeUpdate);
else
prompter.checkForUpdates();
@@ -722,20 +722,20 @@ function updateCheckUpdatesItem()
{
var updateSeparator = document.getElementById("updateSeparator");
checkForUpdates.hidden = true;
updateSeparator.hidden = true;
return;
}
- var updates = Components.classes["@mozilla.org/updates/update-service;1"]
- .getService(Components.interfaces.nsIApplicationUpdateService);
- var um = Components.classes["@mozilla.org/updates/update-manager;1"]
- .getService(Components.interfaces.nsIUpdateManager);
+ var updates = Cc["@mozilla.org/updates/update-service;1"]
+ .getService(Ci.nsIApplicationUpdateService);
+ var um = Cc["@mozilla.org/updates/update-manager;1"]
+ .getService(Ci.nsIUpdateManager);
// Disable the UI if the update enabled pref has been locked by the
// administrator or if we cannot update for some other reason.
var canCheckForUpdates = updates.canCheckForUpdates;
checkForUpdates.setAttribute("disabled", !canCheckForUpdates);
if (!canCheckForUpdates)
return;
@@ -1035,17 +1035,17 @@ function openNewTabWith(aURL, aNode, aPo
function openNewTabWindowOrExistingWith(aType, aURL, aNode, aLoadInBackground,
aPostData, aAllowThirdPartyFixup,
aReferrer)
{
// Make sure we are allowed to open this url
if (aNode)
urlSecurityCheck(aURL, aNode.nodePrincipal,
- Components.interfaces.nsIScriptSecurityManager.STANDARD);
+ Ci.nsIScriptSecurityManager.STANDARD);
// get referrer, if as external should be null
var referrerURI = aReferrer;
if (aNode instanceof Document)
referrerURI = aNode.documentURIObject;
else if (aNode instanceof Element &&
!/(?:^|\s)noreferrer(?:\s|$)/i.test(aNode.getAttribute("rel")))
referrerURI = aNode.ownerDocument.documentURIObject;
@@ -1169,17 +1169,17 @@ function BrowserOnCommand(event)
break;
case "reportButton":
// This is the "Why is this site blocked" button. We redirect
// to the generic page describing phishing/malware protection.
try {
loadURI(Services.urlFormatter.formatURLPref("browser.safebrowsing.warning.infoURL"));
} catch (e) {
- Components.utils.reportError("Couldn't get phishing info URL: " + e);
+ Cu.reportError("Couldn't get phishing info URL: " + e);
}
break;
case "ignoreWarningButton":
if (Services.prefs.getBoolPref("browser.safebrowsing.allowOverride")) {
getBrowser().getNotificationBox().ignoreSafeBrowsingWarning(reason);
}
break;
@@ -1196,17 +1196,17 @@ function BrowserOnCommand(event)
* when their own homepage is infected, we can get them somewhere safe.
*/
function getMeOutOfHere() {
// Get the start page from the *default* pref branch, not the user's
var prefs = Services.prefs.getDefaultBranch(null);
var url = "about:blank";
try {
url = prefs.getComplexValue("browser.startup.homepage",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
} catch(e) {}
loadURI(url);
}
function popupNotificationMenuShowing(event)
{
var notificationbox = document.popupNode.parentNode.control;
var uri = notificationbox.activeBrowser.currentURI;
@@ -1307,17 +1307,17 @@ function isValidFeed(aData, aPrincipal,
{
if (!aData || !aPrincipal)
return null;
var type = aData.type.toLowerCase().replace(/^\s+|\s*(?:;.*)?$/g, "");
if (aIsFeed || /^application\/(?:atom|rss)\+xml$/.test(type)) {
try {
urlSecurityCheck(aData.href, aPrincipal,
- Components.interfaces.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
+ Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
return type || "application/rss+xml";
}
catch(ex) {
}
}
return null;
}
@@ -1366,17 +1366,17 @@ function GetBoolPref(aPrefName, aDefault
return aDefaultValue;
}
function GetIntPref(aPrefName, aDefaultValue)
{
try {
return Services.prefs.getIntPref(aPrefName);
} catch (e) {
- Components.utils.reportError("Couldn't get " + aPrefName + " pref: " + e);
+ Cu.reportError("Couldn't get " + aPrefName + " pref: " + e);
}
return aDefaultValue;
}
/**
* Toggle a splitter to show or hide some piece of UI (e.g. the message preview
* pane).
*
@@ -1499,17 +1499,17 @@ function openUILinkIn(url, where, aAllow
if (arguments.length == 3 && typeof arguments[2] == "object") {
params = aAllowThirdPartyFixup;
} else {
params = {
allowThirdPartyFixup: aAllowThirdPartyFixup,
postData: aPostData,
referrerURI: aReferrerURI,
- referrerPolicy: Components.interfaces.nsIHttpChannel.REFERRER_POLICY_UNSET,
+ referrerPolicy: Ci.nsIHttpChannel.REFERRER_POLICY_UNSET,
};
}
params.fromChrome = true;
openLinkIn(url, where, params);
}
@@ -1738,17 +1738,17 @@ function switchToTabHavingURI(aURI, aOpe
aCallback(browser);
return true;
}
}
return false;
}
// This can be passed either nsIURI or a string.
- if (!(aURI instanceof Components.interfaces.nsIURI))
+ if (!(aURI instanceof Ci.nsIURI))
aURI = Services.io.newURI(aURI);
// Prioritise this window.
if (switchIfURIInWindow(window))
return true;
let winEnum = Services.wm.getEnumerator("navigator:browser");
while (winEnum.hasMoreElements()) {
@@ -1916,31 +1916,31 @@ function FillInHTMLTooltip(tipElement)
}
function GetFileFromString(aString)
{
// If empty string just return null.
if (!aString)
return null;
- let commandLine = Components.classes["@mozilla.org/toolkit/command-line;1"]
- .createInstance(Components.interfaces.nsICommandLine);
+ let commandLine = Cc["@mozilla.org/toolkit/command-line;1"]
+ .createInstance(Ci.nsICommandLine);
let uri = commandLine.resolveURI(aString);
- return uri instanceof Components.interfaces.nsIFileURL ?
- uri.file.QueryInterface(Components.interfaces.nsIFile) : null;
+ return uri instanceof Ci.nsIFileURL ?
+ uri.file.QueryInterface(Ci.nsIFile) : null;
}
function CopyImage()
{
- var param = Components.classes["@mozilla.org/embedcomp/command-params;1"]
- .createInstance(Components.interfaces.nsICommandParams);
+ var param = Cc["@mozilla.org/embedcomp/command-params;1"]
+ .createInstance(Ci.nsICommandParams);
param.setLongValue("imageCopy",
- Components.interfaces.nsIContentViewerEdit.COPY_IMAGE_ALL);
+ Ci.nsIContentViewerEdit.COPY_IMAGE_ALL);
document.commandDispatcher.getControllerForCommand("cmd_copyImage")
- .QueryInterface(Components.interfaces.nsICommandController)
+ .QueryInterface(Ci.nsICommandController)
.doCommandWithParams("cmd_copyImage", param);
}
/**
* Moved from toolkit/content/globalOverlay.js
*/
function goSetMenuValue(aCommand, aLabelAttribute) {
var commandNode = top.document.getElementById(aCommand);
--- a/suite/common/viewApplyThemeOverlay.js
+++ b/suite/common/viewApplyThemeOverlay.js
@@ -102,30 +102,30 @@ function previewTheme(event)
LightweightThemeManager.resetPreview();
break;
}
}
function restartApp()
{
// Notify all windows that an application quit has been requested.
- var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
- .createInstance(Components.interfaces.nsISupportsPRBool);
+ var cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]
+ .createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
// Something aborted the quit process.
if (cancelQuit.data)
return;
Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true);
- const nsIAppStartup = Components.interfaces.nsIAppStartup;
- Components.classes["@mozilla.org/toolkit/app-startup;1"]
- .getService(nsIAppStartup)
- .quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit);
+ const nsIAppStartup = Ci.nsIAppStartup;
+ Cc["@mozilla.org/toolkit/app-startup;1"]
+ .getService(nsIAppStartup)
+ .quit(nsIAppStartup.eRestart | nsIAppStartup.eAttemptQuit);
}
function applyTheme(menuitem)
{
if (!menuitem.theme)
return;
menuitem.theme.userDisabled = false;
--- a/suite/common/viewZoomOverlay.js
+++ b/suite/common/viewZoomOverlay.js
@@ -7,18 +7,18 @@
// One of the possible values for the mousewheel.* preferences.
// From nsEventStateManager.cpp.
const MOUSE_SCROLL_ZOOM = 3;
/**
* Controls the "full zoom" setting and its site-specific preferences.
*/
var FullZoom = FullZoom || {
- contentPrefs: Components.classes["@mozilla.org/content-pref/service;1"]
- .getService(Components.interfaces.nsIContentPrefService2),
+ contentPrefs: Cc["@mozilla.org/content-pref/service;1"]
+ .getService(Ci.nsIContentPrefService2),
// Identifies the setting in the content prefs database.
name: "browser.content.full-zoom",
// The global value (if any) for the setting. Asynchronously loaded from the
// service when first requested, then updated by the pref change listener as
// it changes. If there is no global value, then this should be undefined.
globalValue: undefined,
@@ -32,22 +32,22 @@ var FullZoom = FullZoom || {
get siteSpecific() {
return this._siteSpecificPref;
},
//**************************************************************************//
// nsISupports
QueryInterface:
- XPCOMUtils.generateQI([Components.interfaces.nsIDOMEventListener,
- Components.interfaces.nsIObserver,
- Components.interfaces.nsIContentPrefObserver,
- Components.interfaces.nsIContentPrefCallback2,
- Components.interfaces.nsISupportsWeakReference,
- Components.interfaces.nsISupports]),
+ XPCOMUtils.generateQI([Ci.nsIDOMEventListener,
+ Ci.nsIObserver,
+ Ci.nsIContentPrefObserver,
+ Ci.nsIContentPrefCallback2,
+ Ci.nsISupportsWeakReference,
+ Ci.nsISupports]),
//**************************************************************************//
// Initialization & Destruction
init: function FullZoom_init() {
// Listen for scrollwheel events so we can save scrollwheel-based changes.
window.addEventListener("wheel", this, true);
--- a/suite/extensions/debugQA/content/debugQAEditorOverlay.js
+++ b/suite/extensions/debugQA/content/debugQAEditorOverlay.js
@@ -44,17 +44,17 @@ function EditorTestSelection()
if (!selection)
{
dump("No selection!\n");
return;
}
dump("Selection contains:\n");
// 3rd param = column to wrap
- dump(selection.QueryInterface(Components.interfaces.nsISelectionPrivate)
+ dump(selection.QueryInterface(Ci.nsISelectionPrivate)
.toStringWithFormat("text/plain",
kOutputFormatted | kOutputSelectionOnly,
0) + "\n");
var output, i;
dump("====== Selection as node and offsets==========\n");
dump("rangeCount = " + selection.rangeCount + "\n");
@@ -217,17 +217,17 @@ function EditorTestTableLayout()
function EditorShowEmbeddedObjects()
{
dump("\nEmbedded Objects:\n");
try {
var objectArray = GetCurrentEditor().getEmbeddedObjects();
dump(objectArray.length + " embedded objects\n");
for (let i = 0; i < objectArray.length; ++i)
- dump(objectArray.queryElementAt(i, Components.interfaces.nsIDOMNode) + "\n");
+ dump(objectArray.queryElementAt(i, Ci.nsIDOMNode) + "\n");
} catch(e) {}
}
function EditorUnitTests()
{
dump("Running Unit Tests\n");
var numTests = { value:0 };
var numTestsFailed = { value:0 };
@@ -249,23 +249,23 @@ function EditorTestDocument()
dump("Failed to get the doc\n");
}
}
// --------------------------- Logging stuff ---------------------------
function EditorExecuteScript(theFile)
{
- var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance();
- inputStream = inputStream.QueryInterface(Components.interfaces.nsIFileInputStream);
+ var inputStream = Cc["@mozilla.org/network/file-input-stream;1"].createInstance();
+ inputStream = inputStream.QueryInterface(Ci.nsIFileInputStream);
inputStream.init(theFile, 1, 0, false); // open read only
- var scriptableInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance();
- scriptableInputStream = scriptableInputStream.QueryInterface(Components.interfaces.nsIScriptableInputStream);
+ var scriptableInputStream = Cc["@mozilla.org/scriptableinputstream;1"].createInstance();
+ scriptableInputStream = scriptableInputStream.QueryInterface(Ci.nsIScriptableInputStream);
scriptableInputStream.init(inputStream); // open read only
var buf = { value:null };
var tmpBuf = { value:null };
var didTruncate = { value:false };
var lineNum = 0;
var ex;
@@ -317,30 +317,30 @@ function EditorGetScriptFileSpec()
var processDir = GetSpecialDirectory("Home");
processDir.append("journal.js");
return processDir;
}
function EditorStartLog()
{
try {
- var edlog = GetCurrentEditor().QueryInterface(Components.interfaces.nsIEditorLogging);
+ var edlog = GetCurrentEditor().QueryInterface(Ci.nsIEditorLogging);
var fs = EditorGetScriptFileSpec();
edlog.startLogging(fs);
window.content.focus();
fs = null;
}
catch(ex) { dump("Can't start logging!:\n" + ex + "\n"); }
}
function EditorStopLog()
{
try {
- var edlog = GetCurrentEditor().QueryInterface(Components.interfaces.nsIEditorLogging);
+ var edlog = GetCurrentEditor().QueryInterface(Ci.nsIEditorLogging);
edlog.stopLogging();
window.content.focus();
}
catch(ex) { dump("Can't stop logging!:\n" + ex + "\n"); }
}
function EditorRunLog()
{
@@ -404,17 +404,17 @@ function PrintTxnList(txnList, prefixStr
for (i=0 ; i < txnList.numItems; i++)
{
var txn = txnList.getItem(i);
var desc = "TXMgr Batch";
if (txn)
{
try {
- txn = txn.QueryInterface(Components.interfaces.nsPIEditorTransaction);
+ txn = txn.QueryInterface(Ci.nsPIEditorTransaction);
desc = txn.txnDescription;
} catch(e) {
desc = "UnknownTxnType";
}
}
dump(prefixStr + "+ " + desc + "\n");
PrintTxnList(txnList.getChildListForItem(i), prefixStr + "| ");
}
@@ -469,21 +469,21 @@ sampleJSTransaction.prototype = {
{
// We don't do any merging!
return false;
},
QueryInterface: function(aIID, theResult)
{
- if (aIID.equals(Components.interfaces.nsITransaction) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsITransaction) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
},
insert_node_at_point: function(node, container, offset)
{
var childList = container.childNodes;
if (childList.length == 0 || offset >= childList.length)
container.appendChild(node);
@@ -492,17 +492,17 @@ sampleJSTransaction.prototype = {
}
}
function ExecuteJSTransactionViaTxmgr()
{
try {
var editor = GetCurrentEditor();
var txmgr = editor.transactionManager;
- txmgr = txmgr.QueryInterface(Components.interfaces.nsITransactionManager);
+ txmgr = txmgr.QueryInterface(Ci.nsITransactionManager);
var selection = editor.selection;
var range = selection.getRangeAt(0);
var txn = new sampleJSTransaction();
txn.mContainer = range.startContainer;
txn.mOffset = range.startOffset;
--- a/suite/extensions/debugQA/content/debugQAMenuOverlay.js
+++ b/suite/extensions/debugQA/content/debugQAMenuOverlay.js
@@ -13,18 +13,18 @@ function onLoadBloat()
{
window.removeEventListener("load", onLoadBloat);
// Ignore windows which don't get the Debug menu, like 'View Source'.
if (!document.getElementById("debugMenu"))
return;
// Enable the menu, only if its feature is currently active.
- var envSvc = Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment);
+ var envSvc = Cc["@mozilla.org/process/environment;1"]
+ .getService(Ci.nsIEnvironment);
// Checking the environment variables is good enough,
// as the Bloat service doesn't report the status of its statistics feature.
if (envSvc.exists("XPCOM_MEM_BLOAT_LOG") ||
envSvc.exists("XPCOM_MEM_LEAK_LOG"))
document.getElementById("bloatMenu").disabled = false;
document.getElementById("bloatSeparator").hidden = false;
document.getElementById("bloatMenu").hidden = false;
--- a/suite/extensions/debugQA/content/debugQANavigatorOverlay.xul
+++ b/suite/extensions/debugQA/content/debugQANavigatorOverlay.xul
@@ -14,18 +14,18 @@
if (Services.prefs.getBoolPref("debugQA.show.buildId"))
window.addEventListener("load", debugQABuildIDOnLoad, true);
} catch (e) {}
// Set the title modifer to include the build id.
function debugQABuildIDOnLoad() {
window.removeEventListener("load", debugQABuildIDOnLoad, true);
- var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
- .getService(Components.interfaces.nsIXULAppInfo);
+ var appInfo = Cc["@mozilla.org/xre/app-info;1"]
+ .getService(Ci.nsIXULAppInfo);
var bundle = document.getElementById("debugQANavigatorBundle");
var titlemodifier =
document.documentElement.getAttribute("titlemodifier") ||
document.documentElement.getAttribute("titledefault");
titlemodifier = bundle.getFormattedString("titlemodifier",
--- a/suite/feeds/src/FeedConverter.js
+++ b/suite/feeds/src/FeedConverter.js
@@ -26,59 +26,59 @@ const PREF_VIDEO_SELECTED_READER = "brow
const PREF_AUDIO_SELECTED_APP = "browser.audioFeeds.handlers.application";
const PREF_AUDIO_SELECTED_WEB = "browser.audioFeeds.handlers.webservice";
const PREF_AUDIO_SELECTED_ACTION = "browser.audioFeeds.handler";
const PREF_AUDIO_SELECTED_READER = "browser.audioFeeds.handler.default";
function getPrefAppForType(t) {
switch (t) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
return PREF_VIDEO_SELECTED_APP;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
return PREF_AUDIO_SELECTED_APP;
default:
return PREF_SELECTED_APP;
}
}
function getPrefWebForType(t) {
switch (t) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
return PREF_VIDEO_SELECTED_WEB;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
return PREF_AUDIO_SELECTED_WEB;
default:
return PREF_SELECTED_WEB;
}
}
function getPrefActionForType(t) {
switch (t) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
return PREF_VIDEO_SELECTED_ACTION;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
return PREF_AUDIO_SELECTED_ACTION;
default:
return PREF_SELECTED_ACTION;
}
}
function getPrefReaderForType(t) {
switch (t) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
return PREF_VIDEO_SELECTED_READER;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
return PREF_AUDIO_SELECTED_READER;
default:
return PREF_SELECTED_READER;
}
}
function LOG(str) {
@@ -118,29 +118,29 @@ FeedConverter.prototype = {
* Records if the feed was sniffed
*/
_sniffed: false,
/**
* See nsISupports.idl
*/
QueryInterface: XPCOMUtils.generateQI(
- [Components.interfaces.nsIFeedResultListener,
- Components.interfaces.nsIStreamConverter,
- Components.interfaces.nsIStreamListener,
- Components.interfaces.nsIRequestObserver,
- Components.interfaces.nsISupports]),
+ [Ci.nsIFeedResultListener,
+ Ci.nsIStreamConverter,
+ Ci.nsIStreamListener,
+ Ci.nsIRequestObserver,
+ Ci.nsISupports]),
classID: Components.ID("{88592f45-3866-4c8e-9d8a-ab58b290fcf7}"),
/**
* See nsIStreamConverter.idl
*/
convert: function convert(sourceStream, sourceType, destinationType,
context) {
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
/**
* See nsIStreamConverter.idl
*/
asyncConvertData: function asyncConvertData(sourceType, destinationType,
listener, context) {
this._listener = listener;
@@ -190,34 +190,34 @@ FeedConverter.prototype = {
// handler for other stream types. In those cases, the user will always see
// the preview page and have to select a handler. We can guess and show
// a client handler, but will not be able to show web handlers for those
// types.
//
// If this is just a feed, not some kind of specialized application, then
// auto-handlers can be set and we should obey them.
try {
- var feedService = Components.classes["@mozilla.org/browser/feeds/result-service;1"]
- .getService(Components.interfaces.nsIFeedResultService);
+ var feedService = Cc["@mozilla.org/browser/feeds/result-service;1"]
+ .getService(Ci.nsIFeedResultService);
if (!this._forcePreviewPage && result.doc) {
- var feed = result.doc.QueryInterface(Components.interfaces.nsIFeed);
+ var feed = result.doc.QueryInterface(Ci.nsIFeed);
var handler = safeGetCharPref(getPrefActionForType(feed.type), "ask");
if (handler != "ask") {
if (handler == "reader")
handler = safeGetCharPref(getPrefReaderForType(feed.type), "messenger");
switch (handler) {
case "web":
- var wccr = Components.classes["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
- .getService(Components.interfaces.nsIWebContentConverterService);
- if ((feed.type == Components.interfaces.nsIFeed.TYPE_FEED &&
+ var wccr = Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
+ .getService(Ci.nsIWebContentConverterService);
+ if ((feed.type == Ci.nsIFeed.TYPE_FEED &&
wccr.getAutoHandler(TYPE_MAYBE_FEED)) ||
- (feed.type == Components.interfaces.nsIFeed.TYPE_VIDEO &&
+ (feed.type == Ci.nsIFeed.TYPE_VIDEO &&
wccr.getAutoHandler(TYPE_MAYBE_VIDEO_FEED)) ||
- (feed.type == Components.interfaces.nsIFeed.TYPE_AUDIO &&
+ (feed.type == Ci.nsIFeed.TYPE_AUDIO &&
wccr.getAutoHandler(TYPE_MAYBE_AUDIO_FEED))) {
wccr.loadPreferredHandler(this._request);
return;
}
break;
default:
LOG("unexpected handler: " + handler);
@@ -233,17 +233,17 @@ FeedConverter.prototype = {
} catch(ex) {
/* fallback to preview mode */
}
}
}
}
var chromeChannel;
- var oldChannel = this._request.QueryInterface(Components.interfaces.nsIChannel);
+ var oldChannel = this._request.QueryInterface(Ci.nsIChannel);
var loadInfo = oldChannel.loadInfo;
// If there was no automatic handler, or this was a podcast,
// photostream or some other kind of application, show the
// preview page if the parser returned a document.
if (result.doc) {
// Store the result in the result service so that the display
@@ -279,48 +279,48 @@ FeedConverter.prototype = {
this._processor.onDataAvailable(request, context, inputStream,
sourceOffset, count);
},
/**
* See nsIRequestObserver.idl
*/
onStartRequest: function onStartRequest(request, context) {
- var channel = request.QueryInterface(Components.interfaces.nsIChannel);
+ var channel = request.QueryInterface(Ci.nsIChannel);
// Check for a header that tells us there was no sniffing
// The value doesn't matter.
try {
- var httpChannel = channel.QueryInterface(Components.interfaces.nsIHttpChannel);
+ var httpChannel = channel.QueryInterface(Ci.nsIHttpChannel);
// Make sure to check requestSucceeded before the potentially-throwing
// getResponseHeader.
if (!httpChannel.requestSucceeded) {
// Just give up, but don't forget to cancel the channel first!
- request.cancel(Components.results.NS_BINDING_ABORTED);
+ request.cancel(Cr.NS_BINDING_ABORTED);
return;
}
// Note: this throws if the header is not set.
httpChannel.getResponseHeader("X-Moz-Is-Feed");
}
catch (ex) {
this._sniffed = true;
}
this._request = request;
// Save and reset the forced state bit early, in case there's some kind of
// error.
- var feedService = Components.classes["@mozilla.org/browser/feeds/result-service;1"]
- .getService(Components.interfaces.nsIFeedResultService);
+ var feedService = Cc["@mozilla.org/browser/feeds/result-service;1"]
+ .getService(Ci.nsIFeedResultService);
this._forcePreviewPage = feedService.forcePreviewPage;
feedService.forcePreviewPage = false;
// Parse feed data as it comes in
- this._processor = Components.classes["@mozilla.org/feed-processor;1"]
- .createInstance(Components.interfaces.nsIFeedProcessor);
+ this._processor = Cc["@mozilla.org/feed-processor;1"]
+ .createInstance(Ci.nsIFeedProcessor);
this._processor.listener = this;
this._processor.parseAsync(null, channel.URI);
this._processor.onStartRequest(request, context);
},
/**
* See nsIRequestObserver.idl
@@ -357,17 +357,17 @@ FeedResultService.prototype = {
addToClientReader: function addToClientReader(spec, title, subtitle, feedType) {
var handler = safeGetCharPref(getPrefActionForType(feedType), "reader");
if (handler == "ask" || handler == "reader")
handler = safeGetCharPref(getPrefReaderForType(feedType), "messenger");
switch (handler) {
case "client":
var clientApp = Services.prefs.getComplexValue(getPrefAppForType(feedType),
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
// For the benefit of applications that might know how to deal with more
// URLs than just feeds, send feed: URLs in the following format:
//
// http urls: replace scheme with feed, e.g.
// http://foo.com/index.rdf -> feed://foo.com/index.rdf
// other urls: prepend feed: scheme, e.g.
// https://foo.com/index.rdf -> feed:https://foo.com/index.rdf
@@ -377,42 +377,42 @@ FeedResultService.prototype = {
spec = feedURI.spec;
}
else
spec = "feed:" + spec;
// Retrieving the shell service might fail on some systems, most
// notably systems where GNOME is not installed.
try {
- var ss = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(Components.interfaces.nsIShellService);
+ var ss = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(Ci.nsIShellService);
ss.openApplicationWithURI(clientApp, spec);
} catch(e) {
// If we couldn't use the shell service, fallback to using a
// nsIProcess instance
- var p = Components.classes["@mozilla.org/process/util;1"]
- .createInstance(Components.interfaces.nsIProcess);
+ var p = Cc["@mozilla.org/process/util;1"]
+ .createInstance(Ci.nsIProcess);
p.init(clientApp);
p.run(false, [spec], 1);
}
break;
default:
// "web" should have been handled elsewhere
LOG("unexpected handler: " + handler);
// fall through
case "bookmarks":
var topWindow = Services.wm.getMostRecentWindow("navigator:browser");
topWindow.PlacesCommandHook.addLiveBookmark(spec, title, subtitle)
- .catch(Components.utils.reportError);
+ .catch(Cu.reportError);
break;
case "messenger":
- Components.classes["@mozilla.org/newsblog-feed-downloader;1"]
- .getService(Components.interfaces.nsINewsBlogFeedDownloader)
- .subscribeToFeed("feed:" + spec, null, null);
+ Cc["@mozilla.org/newsblog-feed-downloader;1"]
+ .getService(Ci.nsINewsBlogFeedDownloader)
+ .subscribeToFeed("feed:" + spec, null, null);
break;
}
},
/**
* See nsIFeedResultService.idl
*/
@@ -457,18 +457,18 @@ FeedResultService.prototype = {
// send the holes to the end
resultList.sort();
// and trim the list
resultList.splice(resultList.length - deletions, deletions);
if (resultList.length == 0)
delete this._results[uri.spec];
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIFeedResultService,
- Components.interfaces.nsISupports]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIFeedResultService,
+ Ci.nsISupports]),
classID: Components.ID("{e5b05e9d-f037-48e4-b9a4-b99476582927}")
};
/**
* A protocol handler that attempts to deal with the variant forms of feed:
* URIs that are actually either http or https.
*/
function GenericProtocolHandler(scheme, classID) {
@@ -500,54 +500,54 @@ GenericProtocolHandler.prototype = {
newURI: function newURI(spec, originalCharset, baseURI) {
// Feed URIs can be either nested URIs of the form feed:realURI (in which
// case we create a nested URI for the realURI) or feed://example.com, in
// which case we create a nested URI for the real protocol which is http.
spec = spec.replace(/^\s+|[\r\n\t]+|\s+$/g, "");
if (!/^feed:/.test(spec))
- throw Components.results.NS_ERROR_MALFORMED_URI;
+ throw Cr.NS_ERROR_MALFORMED_URI;
var prefix = /^feed:\/\//.test(spec) ? "http:" : "";
var inner = Services.io.newURI(spec.replace("feed:", prefix),
originalCharset, baseURI);
if (! /^https?/.test(inner.scheme))
- throw Components.results.NS_ERROR_MALFORMED_URI;
+ throw Cr.NS_ERROR_MALFORMED_URI;
- var uri = Services.io.QueryInterface(Components.interfaces.nsINetUtil)
+ var uri = Services.io.QueryInterface(Ci.nsINetUtil)
.newSimpleNestedURI(inner);
uri.spec = inner.spec.replace(prefix, "feed:");
return uri;
},
newChannel: function newChannel(aUri) {
return this.newChannel2(aUri, null);
},
newChannel2: function newChannel(aUri, aLoadinfo) {
- var uri = aUri.QueryInterface(Components.interfaces.nsINestedURI).innerURI;
+ var uri = aUri.QueryInterface(Ci.nsINestedURI).innerURI;
var ios = Services.io;
var channel = aLoadinfo ?
ios.newChannelFromURIWithLoadInfo(uri, aLoadinfo) :
ios.newChannelFromURI2(uri, null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
- if (channel instanceof Components.interfaces.nsIHttpChannel)
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
+ if (channel instanceof Ci.nsIHttpChannel)
// Set this so we know this is supposed to be a feed
channel.setRequestHeader("X-Moz-Is-Feed", "1", false);
channel.originalURI = aUri;
return channel;
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIProtocolHandler,
- Components.interfaces.nsISupports])
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler,
+ Ci.nsISupports])
};
function FeedProtocolHandler() {
}
FeedProtocolHandler.prototype = new GenericProtocolHandler("feed",
Components.ID("{a95d7f48-11be-4324-8872-d23bd79fe78b}"));
--- a/suite/feeds/src/FeedWriter.js
+++ b/suite/feeds/src/FeedWriter.js
@@ -35,59 +35,59 @@ const PREF_AUDIO_SELECTED_READER = "brow
const PREF_SHOW_FIRST_RUN_UI = "browser.feeds.showFirstRunUI";
const TITLE_ID = "feedTitleText";
const SUBTITLE_ID = "feedSubtitleText";
function getPrefAppForType(t) {
switch (t) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
return PREF_VIDEO_SELECTED_APP;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
return PREF_AUDIO_SELECTED_APP;
default:
return PREF_SELECTED_APP;
}
}
function getPrefWebForType(t) {
switch (t) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
return PREF_VIDEO_SELECTED_WEB;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
return PREF_AUDIO_SELECTED_WEB;
default:
return PREF_SELECTED_WEB;
}
}
function getPrefActionForType(t) {
switch (t) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
return PREF_VIDEO_SELECTED_ACTION;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
return PREF_AUDIO_SELECTED_ACTION;
default:
return PREF_SELECTED_ACTION;
}
}
function getPrefReaderForType(t) {
switch (t) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
return PREF_VIDEO_SELECTED_READER;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
return PREF_AUDIO_SELECTED_READER;
default:
return PREF_SELECTED_READER;
}
}
function LOG(str) {
@@ -143,24 +143,24 @@ function convertByteUnits(aBytes) {
// Get rid of insignificant bits by truncating to 1 or 0 decimal points
// 0 -> 0; 1.2 -> 1.2; 12.3 -> 12.3; 123.4 -> 123; 234.5 -> 235
aBytes = aBytes.toFixed((aBytes > 0) && (aBytes < 100) ? 1 : 0);
return [aBytes, units[unitIndex]];
}
function FeedWriter() {
- this._mimeSvc = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService);
+ this._mimeSvc = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService);
}
FeedWriter.prototype = {
_getPropertyAsBag: function getPropertyAsBag(container, property) {
return container.fields.getProperty(property)
- .QueryInterface(Components.interfaces.nsIPropertyBag2);
+ .QueryInterface(Ci.nsIPropertyBag2);
},
_getPropertyAsString: function getPropertyAsString(container, property) {
try {
return container.fields.getPropertyAsAString(property);
}
catch (e) {
}
@@ -192,34 +192,34 @@ FeedWriter.prototype = {
* @param element
* The element to set a URI attribute on
* @param attribute
* The attribute of the element to set the URI to, e.g. href or src
* @param uri
* The URI spec to set as the href
*/
_safeSetURIAttribute: function safeSetURIAttribute(element, attribute, uri) {
- const flags = Components.interfaces.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL;
+ const flags = Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL;
try {
Services.scriptSecurityManager.checkLoadURIStrWithPrincipal(this._feedPrincipal, uri, flags);
// checkLoadURIStrWithPrincipal will throw if the link URI should not be
// loaded, either because our feedURI isn't allowed to load it or per
// the rules specified in |flags|, so we'll never "linkify" the link...
element.setAttribute(attribute, uri);
}
catch (e) {
// Not allowed to load this link because checkLoadURIStrWithPrincipal threw
}
},
__faviconService: null,
get _faviconService() {
if (!this.__faviconService)
- this.__faviconService = Components.classes["@mozilla.org/browser/favicon-service;1"]
- .getService(Components.interfaces.mozIAsyncFavicons);
+ this.__faviconService = Cc["@mozilla.org/browser/favicon-service;1"]
+ .getService(Ci.mozIAsyncFavicons);
return this.__faviconService;
},
__bundle: null,
get _bundle() {
if (!this.__bundle) {
this.__bundle = Services.strings.createBundle(STRING_BUNDLE_URI);
@@ -292,34 +292,34 @@ FeedWriter.prototype = {
__feedType: null,
_getFeedType: function getFeedType() {
if (this.__feedType != null)
return this.__feedType;
try {
// grab the feed because it's got the feed.type in it.
var container = this._getContainer();
- var feed = container.QueryInterface(Components.interfaces.nsIFeed);
+ var feed = container.QueryInterface(Ci.nsIFeed);
this.__feedType = feed.type;
return feed.type;
} catch (ex) {
}
- return Components.interfaces.nsIFeed.TYPE_FEED;
+ return Ci.nsIFeed.TYPE_FEED;
},
/**
* Maps a feed type to a maybe-feed mimetype.
*/
_getMimeTypeForFeedType: function getMimeTypeForFeedType() {
switch (this._getFeedType()) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
return TYPE_MAYBE_VIDEO_FEED;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
return TYPE_MAYBE_AUDIO_FEED;
default:
return TYPE_MAYBE_FEED;
}
},
/**
@@ -328,17 +328,17 @@ FeedWriter.prototype = {
* The feed container, an nsIFeedContainer
*/
_setTitleText: function setTitleText(container) {
if (container.title) {
this._setContentText(TITLE_ID, container.title);
this._document.title = container.title.plainText();
}
- var feed = container.QueryInterface(Components.interfaces.nsIFeed);
+ var feed = container.QueryInterface(Ci.nsIFeed);
if (feed && feed.subtitle)
this._setContentText(SUBTITLE_ID, feed.subtitle);
},
/**
* Writes the title image into the preview document if one is present.
* @param container
* The feed container
@@ -371,25 +371,25 @@ FeedWriter.prototype = {
/**
* Writes all entries contained in the feed.
* @param container
* The container of entries in the feed
*/
_writeFeedContent: function writeFeedContent(container) {
// Build the actual feed content
- var feed = container.QueryInterface(Components.interfaces.nsIFeed);
+ var feed = container.QueryInterface(Ci.nsIFeed);
if (feed.items.length == 0)
return;
var feedContent = this._document.getElementById("feedContent");
for (let i = 0; i < feed.items.length; ++i) {
- let entry = feed.items.queryElementAt(i, Components.interfaces.nsIFeedEntry);
- entry.QueryInterface(Components.interfaces.nsIFeedContainer);
+ let entry = feed.items.queryElementAt(i, Ci.nsIFeedEntry);
+ entry.QueryInterface(Ci.nsIFeedContainer);
let entryContainer = this._document.createElementNS(HTML_NS, "div");
entryContainer.className = "entry";
// If the entry has a title, make it a link
if (entry.title) {
let a = this._document.createElementNS(HTML_NS, "a");
let span = this._document.createElementNS(HTML_NS, "span");
@@ -462,17 +462,17 @@ FeedWriter.prototype = {
* http://example.com/somedirectory/).
* @param aURL
* The URL string from which to create a display name
* @returns a string
*/
_getURLDisplayName: function getURLDisplayName(aURL) {
var url = makeURI(aURL);
- if ((url instanceof Components.interfaces.nsIURL) && url.fileName)
+ if ((url instanceof Ci.nsIURL) && url.fileName)
return decodeURIComponent(url.fileName);
return aURL;
},
/**
* Takes a FeedEntry with enclosures, generates the HTML code to represent
* them, and returns that.
* @param entry
@@ -481,17 +481,17 @@ FeedWriter.prototype = {
*/
_buildEnclosureDiv: function buildEnclosureDiv(entry) {
var enclosuresDiv = this._document.createElementNS(HTML_NS, "div");
enclosuresDiv.className = "enclosures";
enclosuresDiv.appendChild(this._document.createTextNode(this._getString("mediaLabel")));
for (let i_enc = 0; i_enc < entry.enclosures.length; ++i_enc) {
- let enc = entry.enclosures.queryElementAt(i_enc, Components.interfaces.nsIWritablePropertyBag2);
+ let enc = entry.enclosures.queryElementAt(i_enc, Ci.nsIWritablePropertyBag2);
if (!(enc.hasKey("url")))
continue;
let enclosureDiv = this._document.createElementNS(HTML_NS, "div");
enclosureDiv.setAttribute("class", "enclosure");
let mozicon = "moz-icon://.txt?size=16";
@@ -552,18 +552,18 @@ FeedWriter.prototype = {
* Gets a valid nsIFeedContainer object from the parsed nsIFeedResult.
* Displays error information if there was one.
* @param result
* The parsed feed result
* @returns A valid nsIFeedContainer object containing the contents of
* the feed.
*/
_getContainer: function getContainer(result) {
- var feedService = Components.classes["@mozilla.org/browser/feeds/result-service;1"]
- .getService(Components.interfaces.nsIFeedResultService);
+ var feedService = Cc["@mozilla.org/browser/feeds/result-service;1"]
+ .getService(Ci.nsIFeedResultService);
try {
var result = feedService.getFeedResult(this._getOriginalURI(this._window));
if (result.bozo) {
LOG("Subscribe Preview: feed result is bozo?!");
}
}
@@ -585,39 +585,39 @@ FeedWriter.prototype = {
* Get the human-readable display name of a file. This could be the
* application name.
* @param file
* A nsIFile to look up the name of
* @returns The display name of the application represented by the file.
*/
_getFileDisplayName: function getFileDisplayName(file) {
if ("nsILocalFileWin" in Components.interfaces &&
- file instanceof Components.interfaces.nsILocalFileWin) {
+ file instanceof Ci.nsILocalFileWin) {
try {
return file.getVersionInfoField("FileDescription");
} catch (e) {}
}
else if ("nsILocalFileMac" in Components.interfaces &&
- file instanceof Components.interfaces.nsILocalFileMac) {
+ file instanceof Ci.nsILocalFileMac) {
try {
return file.bundleDisplayName;
} catch (e) {}
}
return file.leafName;
},
/**
* Get moz-icon url for a file
* @param file
* A nsIFile object for which the moz-icon:// is returned
* @returns moz-icon url of the given file as a string
*/
_getFileIconURL: function getFileIconURL(file) {
var fph = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
var urlSpec = fph.getURLSpecFromFile(file);
return "moz-icon://" + urlSpec + "?size=16";
},
/**
* Helper method to set the selected application and system default
* reader menuitems details from a file object
* @param aMenuItem
@@ -640,27 +640,27 @@ FeedWriter.prototype = {
},
/**
* Displays a prompt from which the user may choose a (client) feed reader.
* @return - true if a feed reader was selected, false otherwise.
*/
_chooseClientApp: function chooseClientApp() {
try {
- var fp = Components.classes["@mozilla.org/filepicker;1"]
- .createInstance(Components.interfaces.nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"]
+ .createInstance(Ci.nsIFilePicker);
fp.init(this._window,
this._getString("chooseApplicationDialogTitle"),
- Components.interfaces.nsIFilePicker.modeOpen);
- fp.appendFilters(Components.interfaces.nsIFilePicker.filterApps);
+ Ci.nsIFilePicker.modeOpen);
+ fp.appendFilters(Ci.nsIFilePicker.filterApps);
- if (fp.show() == Components.interfaces.nsIFilePicker.returnOK) {
+ if (fp.show() == Ci.nsIFilePicker.returnOK) {
this._selectedApp = fp.file;
if (this._selectedApp) {
- var file = Services.dirsvc.get("XREExeF", Components.interfaces.nsIFile);
+ var file = Services.dirsvc.get("XREExeF", Ci.nsIFile);
if (fp.file.leafName != file.leafName) {
this._initMenuItemWithFile(this._selectedAppMenuItem,
this._selectedApp);
// Show and select the selected application menuitem
this._selectedAppMenuItem.hidden = false;
this._selectedAppMenuItem.doCommand();
return true;
@@ -680,42 +680,42 @@ FeedWriter.prototype = {
var alwaysUse = (safeGetCharPref(getPrefActionForType(feedType), "ask") != "ask");
this._setCheckboxCheckedState(checkbox, alwaysUse);
}
},
_setSubscribeUsingLabel: function setSubscribeUsingLabel() {
var stringLabel = "subscribeFeedUsing";
switch (this._getFeedType()) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
stringLabel = "subscribeVideoPodcastUsing";
break;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
stringLabel = "subscribeAudioPodcastUsing";
break;
}
var subscribeUsing = this._getUIElement("subscribeUsingDescription");
subscribeUsing.setAttribute("value", this._getString(stringLabel));
},
_setAlwaysUseLabel: function setAlwaysUseLabel() {
var checkbox = this._getUIElement("alwaysUse");
if (checkbox) {
if (this._handlersMenuList) {
var handlerName = this._getSelectedItemFromMenulist(this._handlersMenuList)
.getAttribute("label");
var stringLabel = "alwaysUseForFeeds";
switch (this._getFeedType()) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
stringLabel = "alwaysUseForVideoPodcasts";
break;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
stringLabel = "alwaysUseForAudioPodcasts";
break;
}
checkbox.setAttribute("label", this._getFormattedString(stringLabel, [handlerName]));
}
}
},
@@ -774,17 +774,17 @@ FeedWriter.prototype = {
handlers[0].doCommand();
}
break;
case "client":
try {
this._selectedApp =
Services.prefs.getComplexValue(getPrefAppForType(feedType),
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
}
catch(ex) {
this._selectedApp = null;
}
if (this._selectedApp) {
this._initMenuItemWithFile(this._selectedAppMenuItem,
this._selectedApp);
@@ -818,21 +818,21 @@ FeedWriter.prototype = {
if (!handlersMenuPopup)
return;
var feedType = this._getFeedType();
// change the background
var header = this._document.getElementById("feedHeader");
switch (feedType) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
header.className = "videoPodcastBackground";
break;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
header.className = "audioPodcastBackground";
break;
default:
header.className = "feedBackground";
}
var liveBookmarksMenuItem = this._getUIElement("liveBookmarksMenuItem");
@@ -840,17 +840,17 @@ FeedWriter.prototype = {
// Last-selected application
var menuItem = liveBookmarksMenuItem.cloneNode(false);
menuItem.removeAttribute("selected");
menuItem.setAttribute("anonid", "selectedAppMenuItem");
menuItem.className = "menuitem-iconic selectedAppMenuItem";
menuItem.setAttribute("handlerType", "client");
try {
this._selectedApp = Services.prefs.getComplexValue(getPrefAppForType(feedType),
- Components.interfaces.nsIFile);
+ Ci.nsIFile);
if (this._selectedApp.exists())
this._initMenuItemWithFile(menuItem, this._selectedApp);
else {
// Hide the menuitem if the last selected application doesn't exist
menuItem.hidden = true;
}
}
@@ -858,19 +858,19 @@ FeedWriter.prototype = {
// Hide the menuitem until an application is selected
menuItem.hidden = true;
}
this._selectedAppMenuItem = menuItem;
handlersMenuPopup.appendChild(menuItem);
// List the default feed reader
try {
- this._defaultSystemReader = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(Components.interfaces.nsIShellService)
- .defaultFeedReader;
+ this._defaultSystemReader = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(Ci.nsIShellService)
+ .defaultFeedReader;
menuItem = liveBookmarksMenuItem.cloneNode(false);
menuItem.removeAttribute("selected");
menuItem.setAttribute("anonid", "defaultHandlerMenuItem");
menuItem.className = "menuitem-iconic defaultHandlerMenuItem";
menuItem.setAttribute("handlerType", "client");
this._initMenuItemWithFile(menuItem, this._defaultSystemReader);
@@ -896,18 +896,18 @@ FeedWriter.prototype = {
menuItem.setAttribute("label", this._getString("chooseApplicationMenuItem"));
handlersMenuPopup.appendChild(menuItem);
// separator
menuItem = liveBookmarksMenuItem.nextSibling.cloneNode(false);
handlersMenuPopup.appendChild(menuItem);
// List of web handlers
- var wccr = Components.classes["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
- .getService(Components.interfaces.nsIWebContentConverterService);
+ var wccr = Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
+ .getService(Ci.nsIWebContentConverterService);
var handlers = wccr.getContentHandlers(this._getMimeTypeForFeedType(feedType));
if (handlers.length != 0) {
for (let i = 0; i < handlers.length; ++i) {
menuItem = liveBookmarksMenuItem.cloneNode(false);
menuItem.removeAttribute("selected");
menuItem.className = "menuitem-iconic";
menuItem.setAttribute("label", handlers[i].name);
menuItem.setAttribute("handlerType", "web");
@@ -940,21 +940,21 @@ FeedWriter.prototype = {
try {
showFirstRunUI = Services.prefs.getBoolPref(PREF_SHOW_FIRST_RUN_UI);
}
catch (ex) {
}
if (showFirstRunUI) {
var textfeedinfo1, textfeedinfo2;
switch (feedType) {
- case Components.interfaces.nsIFeed.TYPE_VIDEO:
+ case Ci.nsIFeed.TYPE_VIDEO:
textfeedinfo1 = "feedSubscriptionVideoPodcast1";
textfeedinfo2 = "feedSubscriptionVideoPodcast2";
break;
- case Components.interfaces.nsIFeed.TYPE_AUDIO:
+ case Ci.nsIFeed.TYPE_AUDIO:
textfeedinfo1 = "feedSubscriptionAudioPodcast1";
textfeedinfo2 = "feedSubscriptionAudioPodcast2";
break;
default:
textfeedinfo1 = "feedSubscriptionFeed1";
textfeedinfo2 = "feedSubscriptionFeed2";
}
@@ -969,28 +969,28 @@ FeedWriter.prototype = {
/**
* Returns the original URI object of the feed and ensures that this
* component is only ever invoked from the preview document.
* @param aWindow
* The window of the document invoking the BrowserFeedWriter
*/
_getOriginalURI: function getOriginalURI(aWindow) {
- var chan = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
+ var chan = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
.currentDocumentChannel;
// The following channel is never openend, so it does not matter what
// securityFlags we pass; let's follow the principle of least privilege.
var ios = Services.io;
var channel = ios.newChannel2(FEEDHANDLER_URI, null, null, null,
this._feedprincipal,
null,
- Components.interfaces.nsILoadInfo.SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED,
+ Ci.nsIContentPolicy.TYPE_OTHER);
var resolvedURI = channel.URI;
if (resolvedURI.equals(chan.URI))
return chan.originalURI;
return null;
},
@@ -1084,18 +1084,18 @@ FeedWriter.prototype = {
this.__bundle = null;
this._feedURI = null;
this._selectedAppMenuItem = null;
this._defaultHandlerMenuItem = null;
},
_removeFeedFromCache: function removeFeedFromCache() {
if (this._feedURI) {
- var feedService = Components.classes["@mozilla.org/browser/feeds/result-service;1"]
- .getService(Components.interfaces.nsIFeedResultService);
+ var feedService = Cc["@mozilla.org/browser/feeds/result-service;1"]
+ .getService(Ci.nsIFeedResultService);
feedService.removeFeedResult(this._feedURI);
this._feedURI = null;
}
},
_subscribe: function subscribe() {
var feedType = this._getFeedType();
@@ -1115,49 +1115,49 @@ FeedWriter.prototype = {
}
if (selectedItem.hasAttribute("webhandlerurl")) {
var webURI = selectedItem.getAttribute("webhandlerurl");
Services.prefs.setCharPref(getPrefReaderForType(feedType), "web");
Services.prefs.setStringPref(getPrefWebForType(feedType), webURI);
- var wccr = Components.classes["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
- .getService(Components.interfaces.nsIWebContentConverterService);
+ var wccr = Cc["@mozilla.org/embeddor.implemented/web-content-handler-registrar;1"]
+ .getService(Ci.nsIWebContentConverterService);
var handler = wccr.getWebContentHandlerByURI(this._getMimeTypeForFeedType(feedType), webURI);
if (handler) {
if (useAsDefault)
wccr.setAutoHandler(this._getMimeTypeForFeedType(feedType), handler);
this._window.location.href = handler.getHandlerURI(this._window.location.href);
}
}
else {
switch (selectedItem.getAttribute("anonid")) {
case "selectedAppMenuItem":
- Services.prefs.setComplexValue(getPrefAppForType(feedType), Components.interfaces.nsIFile,
+ Services.prefs.setComplexValue(getPrefAppForType(feedType), Ci.nsIFile,
this._selectedApp);
Services.prefs.setCharPref(getPrefReaderForType(feedType), "client");
break;
case "defaultHandlerMenuItem":
- Services.prefs.setComplexValue(getPrefAppForType(feedType), Components.interfaces.nsIFile,
+ Services.prefs.setComplexValue(getPrefAppForType(feedType), Ci.nsIFile,
this._defaultSystemReader);
Services.prefs.setCharPref(getPrefReaderForType(feedType), "client");
break;
case "liveBookmarksMenuItem":
defaultHandler = "bookmarks";
Services.prefs.setCharPref(getPrefReaderForType(feedType), "bookmarks");
break;
case "messengerFeedsMenuItem":
defaultHandler = "messenger";
Services.prefs.setCharPref(getPrefReaderForType(feedType), "messenger");
break;
}
- var feedService = Components.classes["@mozilla.org/browser/feeds/result-service;1"]
- .getService(Components.interfaces.nsIFeedResultService);
+ var feedService = Cc["@mozilla.org/browser/feeds/result-service;1"]
+ .getService(Ci.nsIFeedResultService);
// Pull the title and subtitle out of the document
var feedTitle = this._document.getElementById(TITLE_ID).textContent;
var feedSubtitle = this._document.getElementById(SUBTITLE_ID).textContent;
feedService.addToClientReader(this._window.location.href, feedTitle, feedSubtitle, feedType);
}
// If "Always use..." is checked, we should set PREF_*SELECTED_ACTION
@@ -1215,38 +1215,38 @@ FeedWriter.prototype = {
*/
_setFaviconForWebReader: function setFaviconForWebReader(aReaderUrl, aMenuItem) {
let readerURI = makeURI(aReaderUrl);
if (!/^https?/.test(readerURI.scheme)) {
// Don't try to get a favicon for non http(s) URIs.
return;
}
let faviconURI = makeURI(readerURI.resolve("/favicon.ico"));
- var isPB = this._window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
- .QueryInterface(Components.interfaces.nsILoadContext)
+ var isPB = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
+ .QueryInterface(Ci.nsILoadContext)
.usePrivateBrowsing;
var flags = isPB ? this._faviconService.FAVICON_LOAD_PRIVATE :
this._faviconService.FAVICON_LOAD_NON_PRIVATE;
- var nullPrincipal = Components.classes["@mozilla.org/nullprincipal;1"]
- .createInstance(Components.interfaces.nsIPrincipal);
+ var nullPrincipal = Cc["@mozilla.org/nullprincipal;1"]
+ .createInstance(Ci.nsIPrincipal);
this._faviconService.setAndFetchFaviconForPage(
readerURI, faviconURI, false, flags,
function(aURI, aDataLen, aData, aMimeType) {
if (aDataLen > 0) {
let dataURL = "data:" + aMimeType + ";base64," +
btoa(String.fromCharCode.apply(null, aData));
aMenuItem.setAttribute("image", dataURL);
}
},
nullPrincipal);
},
classID: FEEDWRITER_CID,
- QueryInterface: XPCOMUtils.generateQI([ Components.interfaces.nsIDOMGlobalPropertyInitializer,
- Components.interfaces.nsIDOMEventListener,
- Components.interfaces.nsINavHistoryObserver,
- Components.interfaces.nsIObserver])
+ QueryInterface: XPCOMUtils.generateQI([ Ci.nsIDOMGlobalPropertyInitializer,
+ Ci.nsIDOMEventListener,
+ Ci.nsINavHistoryObserver,
+ Ci.nsIObserver])
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([FeedWriter]);
--- a/suite/feeds/src/WebContentConverter.js
+++ b/suite/feeds/src/WebContentConverter.js
@@ -34,53 +34,53 @@ function LOG(str) {
dump("*** Feeds: " + str + "\n");
}
catch (ex) {
}
}
function getNotificationBox(aWindow)
{
- return aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
+ return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.parentNode.wrappedJSObject;
}
function WebContentConverter() {
}
WebContentConverter.prototype = {
convert: function convert() { },
asyncConvertData: function asyncConvertData() { },
onDataAvailable: function onDataAvailable() { },
onStopRequest: function onStopRequest() { },
onStartRequest: function onStartRequest(request, context) {
- var wccr = Components.classes[WCCR_CONTRACTID]
- .getService(Components.interfaces.nsIWebContentConverterService);
+ var wccr = Cc[WCCR_CONTRACTID]
+ .getService(Ci.nsIWebContentConverterService);
wccr.loadPreferredHandler(request);
},
QueryInterface: XPCOMUtils.generateQI(
- [Components.interfaces.nsIStreamConverter,
- Components.interfaces.nsIStreamListener,
- Components.interfaces.nsISupports])
+ [Ci.nsIStreamConverter,
+ Ci.nsIStreamListener,
+ Ci.nsISupports])
};
var WebContentConverterFactory = {
createInstance: function createInstance(outer, iid) {
if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return new WebContentConverter().QueryInterface(iid);
},
QueryInterface: XPCOMUtils.generateQI(
- [Components.interfaces.nsIFactory,
- Components.interfaces.nsISupports])
+ [Ci.nsIFactory,
+ Ci.nsISupports])
};
function ServiceInfo(contentType, uri, name) {
this._contentType = contentType;
this._uri = uri;
this._name = name;
}
@@ -92,19 +92,19 @@ ServiceInfo.prototype = {
return this._name;
},
/**
* See nsIHandlerApp
*/
equals: function equals(aHandlerApp) {
if (!aHandlerApp)
- throw Components.results.NS_ERROR_NULL_POINTER;
+ throw Cr.NS_ERROR_NULL_POINTER;
- if (aHandlerApp instanceof Components.interfaces.nsIWebContentHandlerInfo &&
+ if (aHandlerApp instanceof Ci.nsIWebContentHandlerInfo &&
aHandlerApp.contentType == this.contentType &&
aHandlerApp.uri == this.uri)
return true;
return false;
},
/**
@@ -124,18 +124,18 @@ ServiceInfo.prototype = {
/**
* See nsIWebContentHandlerInfo
*/
getHandlerURI: function getHandlerURI(uri) {
return this._uri.replace(/%s/gi, encodeURIComponent(uri));
},
QueryInterface: XPCOMUtils.generateQI(
- [Components.interfaces.nsIWebContentHandlerInfo,
- Components.interfaces.nsISupports])
+ [Ci.nsIWebContentHandlerInfo,
+ Ci.nsISupports])
};
function WebContentConverterRegistrar() {
this._contentTypes = { };
this._autoHandleContentTypes = { };
}
WebContentConverterRegistrar.prototype = {
@@ -171,17 +171,17 @@ WebContentConverterRegistrar.prototype =
return null;
},
/**
* See nsIWebContentConverterService
*/
setAutoHandler: function setAutoHandler(contentType, handler) {
if (handler && !this._typeIsRegistered(contentType, handler.uri))
- throw Components.results.NS_ERROR_NOT_AVAILABLE;
+ throw Cr.NS_ERROR_NOT_AVAILABLE;
contentType = this._resolveContentType(contentType);
this._setAutoHandler(contentType, handler);
var autoBranch = Services.prefs.getBranch(PREF_CONTENTHANDLERS_AUTO);
if (handler)
autoBranch.setCharPref(contentType, handler.uri);
else if (autoBranch.prefHasUserValue(contentType))
@@ -211,45 +211,45 @@ WebContentConverterRegistrar.prototype =
}
return null;
},
/**
* See nsIWebContentConverterService
*/
loadPreferredHandler: function loadPreferredHandler(request) {
- var channel = request.QueryInterface(Components.interfaces.nsIChannel);
+ var channel = request.QueryInterface(Ci.nsIChannel);
var contentType = this._resolveContentType(channel.contentType);
var handler = this.getAutoHandler(contentType);
if (handler) {
- request.cancel(Components.results.NS_ERROR_FAILURE);
+ request.cancel(Cr.NS_ERROR_FAILURE);
var webNavigation = channel.notificationCallbacks
- .getInterface(Components.interfaces.nsIWebNavigation);
+ .getInterface(Ci.nsIWebNavigation);
webNavigation.loadURI(handler.getHandlerURI(channel.URI.spec),
- Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE,
+ Ci.nsIWebNavigation.LOAD_FLAGS_NONE,
null, null, null);
}
},
/**
* See nsIWebContentConverterService
*/
removeProtocolHandler: function removeProtocolHandler(aProtocol, aURITemplate) {
- var eps = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
var handlerInfo = eps.getProtocolHandlerInfo(aProtocol);
var handlers = handlerInfo.possibleApplicationHandlers;
for (let i = 0; i < handlers.length; i++) {
try { // We only want to test web handlers
- let handler = handlers.queryElementAt(i, Components.interfaces.nsIWebHandlerApp);
+ let handler = handlers.queryElementAt(i, Ci.nsIWebHandlerApp);
if (handler.uriTemplate == aURITemplate) {
handlers.removeElementAt(i);
- let hs = Components.classes["@mozilla.org/uriloader/handler-service;1"]
- .getService(Components.interfaces.nsIHandlerService);
+ let hs = Cc["@mozilla.org/uriloader/handler-service;1"]
+ .getService(Ci.nsIHandlerService);
hs.store(handlerInfo);
return;
}
} catch (e) {
/* it wasn't a web handler */
}
}
},
@@ -334,55 +334,55 @@ WebContentConverterRegistrar.prototype =
*
* @param aProtocol
* The scheme of the web handler we are checking for.
* @param aURITemplate
* The URI template that the handler uses to handle the protocol.
* @return true if it is already registered, false otherwise.
*/
_protocolHandlerRegistered: function protocolHandlerRegistered(aProtocol, aURITemplate) {
- var eps = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
var handlerInfo = eps.getProtocolHandlerInfo(aProtocol);
var handlers = handlerInfo.possibleApplicationHandlers;
for (let i = 0; i < handlers.length; i++) {
try { // We only want to test web handlers
- let handler = handlers.queryElementAt(i, Components.interfaces.nsIWebHandlerApp);
+ let handler = handlers.queryElementAt(i, Ci.nsIWebHandlerApp);
if (handler.uriTemplate == aURITemplate)
return true;
} catch (e) { /* it wasn't a web handler */ }
}
return false;
},
/**
* See nsIWebContentHandlerRegistrar
*/
registerProtocolHandler: function registerProtocolHandler(aProtocol, aURIString,
aTitle, aContentWindow) {
LOG("registerProtocolHandler(" + aProtocol + "," + aURIString + "," + aTitle + ")");
var win = aContentWindow;
- var isPB = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
- .QueryInterface(Components.interfaces.nsILoadContext)
+ var isPB = win.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
+ .QueryInterface(Ci.nsILoadContext)
.usePrivateBrowsing;
if (isPB) {
// Inside the private browsing mode, we don't want to alert the user to save
// a protocol handler. We log it to the error console so that web developers
// would have some way to tell what's going wrong.
Services.console.logStringMessage("Web page denied access to register a protocol handler inside private browsing mode");
return;
}
// First, check to make sure this isn't already handled internally (we don't
// want to let them take over, say "chrome").
var handler = Services.io.getProtocolHandler(aProtocol);
- if (!(handler instanceof Components.interfaces.nsIExternalProtocolHandler)) {
+ if (!(handler instanceof Ci.nsIExternalProtocolHandler)) {
// This is handled internally, so we don't want them to register
Services.console.logStringMessage("Permission denied to add " + aURIString + " as a protocol handler");
return;
}
// check if it is in the black list
var allowed;
try {
@@ -413,34 +413,34 @@ WebContentConverterRegistrar.prototype =
accessKey: this._getString("addHandlerAddButtonAccesskey"),
protocolInfo: { protocol: aProtocol, uri: uri.spec, name: aTitle },
callback: function addProtocolHandlerButtonCallback(aNotification, aButtonInfo) {
var protocol = aButtonInfo.protocolInfo.protocol;
var uri = aButtonInfo.protocolInfo.uri;
var name = aButtonInfo.protocolInfo.name;
- var handler = Components.classes["@mozilla.org/uriloader/web-handler-app;1"]
- .createInstance(Components.interfaces.nsIWebHandlerApp);
+ var handler = Cc["@mozilla.org/uriloader/web-handler-app;1"]
+ .createInstance(Ci.nsIWebHandlerApp);
handler.name = name;
handler.uriTemplate = uri;
- var eps = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ var eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
var handlerInfo = eps.getProtocolHandlerInfo(protocol);
handlerInfo.possibleApplicationHandlers.appendElement(handler);
// Since the user has agreed to add a new handler, chances are good
// that the next time they see a handler of this type, they're going
// to want to use it. Reset the handlerInfo to ask before the next
// use.
handlerInfo.alwaysAskBeforeHandling = true;
- var hs = Components.classes["@mozilla.org/uriloader/handler-service;1"]
- .getService(Components.interfaces.nsIHandlerService);
+ var hs = Cc["@mozilla.org/uriloader/handler-service;1"]
+ .getService(Ci.nsIHandlerService);
hs.store(handlerInfo);
}
};
buttons = [addButton];
}
var notificationBox = getNotificationBox(aContentWindow);
notificationBox.appendNotification(message,
@@ -571,24 +571,24 @@ WebContentConverterRegistrar.prototype =
}
catch (e) {
// No more handlers
break;
}
}
if (typeBranch) {
typeBranch.setCharPref("type", contentType);
- var pls = Components.classes["@mozilla.org/pref-localizedstring;1"]
- .createInstance(Components.interfaces.nsIPrefLocalizedString);
+ var pls = Cc["@mozilla.org/pref-localizedstring;1"]
+ .createInstance(Ci.nsIPrefLocalizedString);
pls.data = uri;
typeBranch.setComplexValue("uri",
- Components.interfaces.nsIPrefLocalizedString, pls);
+ Ci.nsIPrefLocalizedString, pls);
pls.data = title;
typeBranch.setComplexValue("title",
- Components.interfaces.nsIPrefLocalizedString, pls);
+ Ci.nsIPrefLocalizedString, pls);
Services.prefs.savePrefFile(null);
}
},
/**
* Determines if there is a type with a particular uri registered for the
* specified content type already.
@@ -664,17 +664,17 @@ WebContentConverterRegistrar.prototype =
// Avoid adding duplicates
if (this._typeIsRegistered(contentType, uri))
return;
this._contentTypes[contentType].push(new ServiceInfo(contentType, uri, title));
if (!(contentType in this._blockedTypes)) {
var converterContractID = this._getConverterContractID(contentType);
- var cr = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
+ var cr = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
cr.registerFactory(WCC_CLASSID, WCC_CLASSNAME, converterContractID,
WebContentConverterFactory);
}
},
/**
* See nsIWebContentConverterService
*/
@@ -690,17 +690,17 @@ WebContentConverterRegistrar.prototype =
/**
* See nsIWebContentConverterService
*/
resetHandlersForType: function resetHandlersForType(contentType) {
// currently unused within the tree, so only useful for extensions; previous
// impl. was buggy (and even infinite-looped!), so I argue that this is a
// definite improvement
- throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
/**
* Registers a handler from the settings on a preferences branch.
*
* @param branch
* an nsIPrefBranch containing "type", "uri", and "title" preferences
* corresponding to the content handler to be registered
@@ -715,19 +715,19 @@ WebContentConverterRegistrar.prototype =
* where a user manually removes a reader, but that's not supported yet!
*/
var vals = branch.getChildList("");
if (vals.length == 0)
return;
try {
var type = branch.getCharPref("type");
- var uri = branch.getComplexValue("uri", Components.interfaces.nsIPrefLocalizedString).data;
+ var uri = branch.getComplexValue("uri", Ci.nsIPrefLocalizedString).data;
var title = branch.getComplexValue("title",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
this._updateContentTypeHandlerMap(type, uri, title);
}
catch(ex) {
// do nothing, the next branch might have values
}
},
/**
@@ -785,33 +785,33 @@ WebContentConverterRegistrar.prototype =
}
},
/**
* See nsIFactory
*/
createInstance: function createInstance(outer, iid) {
if (outer != null)
- throw Components.results.NS_ERROR_NO_AGGREGATION;
+ throw Cr.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid);
},
classID: WCCR_CLASSID,
classInfo: XPCOMUtils.generateCI({
classID: WCCR_CLASSID,
contractID: WCCR_CONTRACTID,
- interfaces: [Components.interfaces.nsIWebContentConverterService,
- Components.interfaces.nsIWebContentHandlerRegistrar,
- Components.interfaces.nsIObserver,
- Components.interfaces.nsIFactory],
- flags: Components.interfaces.nsIClassInfo.DOM_OBJECT}),
+ interfaces: [Ci.nsIWebContentConverterService,
+ Ci.nsIWebContentHandlerRegistrar,
+ Ci.nsIObserver,
+ Ci.nsIFactory],
+ flags: Ci.nsIClassInfo.DOM_OBJECT}),
/**
* See nsISupports
*/
QueryInterface: XPCOMUtils.generateQI(
- [Components.interfaces.nsIWebContentConverterService,
- Components.interfaces.nsIWebContentHandlerRegistrar,
- Components.interfaces.nsIObserver,
- Components.interfaces.nsIFactory])
+ [Ci.nsIWebContentConverterService,
+ Ci.nsIWebContentHandlerRegistrar,
+ Ci.nsIObserver,
+ Ci.nsIFactory])
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([WebContentConverterRegistrar]);
--- a/suite/mailnews/addrbook/abCardOverlay.js
+++ b/suite/mailnews/addrbook/abCardOverlay.js
@@ -63,20 +63,20 @@ var gHideABPicker = false;
var gPhotoHandlers = {};
function OnLoadNewCard()
{
InitEditCard();
gEditCard.card =
(("arguments" in window) && (window.arguments.length > 0) &&
- (window.arguments[0] instanceof Components.interfaces.nsIAbCard))
+ (window.arguments[0] instanceof Ci.nsIAbCard))
? window.arguments[0]
- : Components.classes["@mozilla.org/addressbook/cardproperty;1"]
- .createInstance(Components.interfaces.nsIAbCard);
+ : Cc["@mozilla.org/addressbook/cardproperty;1"]
+ .createInstance(Ci.nsIAbCard);
gEditCard.titleProperty = "newContactTitle";
gEditCard.selectedAB = "";
if ("arguments" in window && window.arguments[0])
{
gEditCard.selectedAB = kPersonalAddressbookURI;
if ("selectedAB" in window.arguments[0] &&
@@ -168,26 +168,26 @@ function EditCardOKButton()
}
var listDirectoriesCount = directory.addressLists.length;
var foundDirectories = [];
// create a list of mailing lists and the index where the card is at.
for (let i = 0; i < listDirectoriesCount; i++)
{
- var subdirectory = directory.addressLists.queryElementAt(i, Components.interfaces.nsIAbDirectory);
+ var subdirectory = directory.addressLists.queryElementAt(i, Ci.nsIAbDirectory);
if (subdirectory.isMailList)
{
// See if any card in this list is the one we edited.
// Must compare card contents using .equals() instead of .indexOf()
// because gEditCard is not really a member of the .addressLists array.
let listCardsCount = subdirectory.addressLists.length;
for (let index = 0; index < listCardsCount; index++)
{
- let card = subdirectory.addressLists.queryElementAt(index, Components.interfaces.nsIAbCard);
+ let card = subdirectory.addressLists.queryElementAt(index, Ci.nsIAbCard);
if (card.equals(gEditCard.card))
foundDirectories.push({directory:subdirectory, cardIndex:index});
}
}
}
CheckAndSetCardValues(gEditCard.card, document, false);
@@ -340,17 +340,17 @@ function NotifySaveListeners(directory)
// in which case we need to commit it.
directory.modifyCard(gEditCard.card);
}
function InitPhoneticFields()
{
var showPhoneticFields =
Services.prefs.getComplexValue("mail.addr_book.show_phonetic_fields",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
// show phonetic fields if indicated by the pref
if (showPhoneticFields == "true")
{
for (var i = kPhoneticFields.length; i-- > 0; )
document.getElementById(kPhoneticFields[i]).hidden = false;
}
}
@@ -363,17 +363,17 @@ function InitEditCard()
// Create gEditCard object that contains global variables for the current js
// file.
gEditCard = new Object();
// get specific prefs that gEditCard will need
try {
var displayLastNameFirst =
Services.prefs.getComplexValue("mail.addr_book.displayName.lastnamefirst",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
gEditCard.displayLastNameFirst = (displayLastNameFirst == "true");
gEditCard.generateDisplayName =
Services.prefs.getBoolPref("mail.addr_book.displayName.autoGeneration");
}
catch (ex) {
dump("ex: failed to get pref" + ex + "\n");
}
}
@@ -933,18 +933,18 @@ function removePhoto(aName) {
/**
* Opens a file picker with image filters to look for a contact photo.
* If the user selects a file and clicks OK then the PhotoURI textbox is set
* with a file URI pointing to that file and updatePhoto is called.
*
* @return true if the OK button was clicked and a photo was chosen
*/
function browsePhoto() {
- var nsIFilePicker = Components.interfaces.nsIFilePicker;
- var fp = Components.classes["@mozilla.org/filepicker;1"]
+ var nsIFilePicker = Ci.nsIFilePicker;
+ var fp = Cc["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
fp.init(window, gAddressBookBundle.getString("browsePhoto"), nsIFilePicker.modeOpen);
// Add All Files & Image Files filters and select the latter
fp.appendFilters(nsIFilePicker.filterImages);
fp.appendFilters(nsIFilePicker.filterAll);
if (fp.show() == nsIFilePicker.returnOK) {
@@ -1016,17 +1016,17 @@ var gFilePhotoHandler =
{
onLoad: function(aCard, aDocument)
{
var photoURI = aCard.getProperty("PhotoURI", "");
try
{
var file = Services.io.newURI(photoURI)
- .QueryInterface(Components.interfaces.nsIFileURL)
+ .QueryInterface(Ci.nsIFileURL)
.file;
} catch (e) {}
if (!file)
return false;
aDocument.getElementById("PhotoFile").file = file;
return true;
--- a/suite/mailnews/addrbook/abCardViewOverlay.js
+++ b/suite/mailnews/addrbook/abCardViewOverlay.js
@@ -4,17 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//NOTE: gAddressBookBundle must be defined and set or this Overlay won't work
var gProfileDirURL;
var gMapItURLFormat;
-var gFileHandler = Services.io.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+var gFileHandler = Services.io.getProtocolHandler("file").QueryInterface(Ci.nsIFileProtocolHandler);
var gPhotoDisplayHandlers = {};
var zListName;
var zPrimaryEmail;
var zSecondaryEmail;
var zScreenName;
var zNickname;
var zDisplayName;
@@ -138,19 +138,19 @@ function GetAddressesFromURI(uri)
{
var addresses = "";
var editList = GetDirectoryFromURI(uri);
var addressList = editList.addressLists;
if (addressList) {
var total = addressList.length;
if (total > 0)
- addresses = addressList.queryElementAt(0, Components.interfaces.nsIAbCard).primaryEmail;
+ addresses = addressList.queryElementAt(0, Ci.nsIAbCard).primaryEmail;
for (var i = 1; i < total; i++ ) {
- addresses += ", " + addressList.queryElementAt(i, Components.interfaces.nsIAbCard).primaryEmail;
+ addresses += ", " + addressList.queryElementAt(i, Ci.nsIAbCard).primaryEmail;
}
}
return addresses;
}
function DisplayCardViewPane(realCard)
{
var generatedName = realCard.generateName(Services.prefs.getIntPref("mail.addr_book.lastnamefirst"));
@@ -422,17 +422,17 @@ function cvAddAddressNodes(node, uri)
if (addressList) {
var total = addressList.length;
if (total > 0) {
while (node.hasChildNodes()) {
node.lastChild.remove();
}
for (i = 0; i < total; i++ ) {
var descNode = document.createElement("description");
- var card = addressList.queryElementAt(i, Components.interfaces.nsIAbCard);
+ var card = addressList.queryElementAt(i, Ci.nsIAbCard);
descNode.setAttribute("class", "CardViewLink");
node.appendChild(descNode);
var linkNode = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
linkNode.setAttribute("id", "addr#" + i);
linkNode.setAttribute("href", "mailto:" + card.primaryEmail);
descNode.appendChild(linkNode);
--- a/suite/mailnews/addrbook/abCommon.js
+++ b/suite/mailnews/addrbook/abCommon.js
@@ -284,22 +284,22 @@ function AbEditCard(card)
goEditListDialog(card, card.mailListURI);
} else {
goEditCardDialog(getSelectedDirectoryURI(), card);
}
}
function AbNewMessage()
{
- let params = Components.classes["@mozilla.org/messengercompose/composeparams;1"].createInstance(Components.interfaces.nsIMsgComposeParams);
+ let params = Cc["@mozilla.org/messengercompose/composeparams;1"].createInstance(Ci.nsIMsgComposeParams);
if (params) {
- let composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"].createInstance(Components.interfaces.nsIMsgCompFields);
+ let composeFields = Cc["@mozilla.org/messengercompose/composefields;1"].createInstance(Ci.nsIMsgCompFields);
if (composeFields) {
- params.type = Components.interfaces.nsIMsgCompType.New;
- params.format = Components.interfaces.nsIMsgCompFormat.Default;
+ params.type = Ci.nsIMsgCompType.New;
+ params.format = Ci.nsIMsgCompFormat.Default;
if (DirPaneHasFocus()) {
let selectedDir = getSelectedDirectory();
let hidesRecipients = false;
try {
// This is a bit of hackery so that extensions can have mailing lists
// where recipients are sent messages via BCC.
hidesRecipients = selectedDir.getBoolValue("HidesRecipients", false);
} catch(e) {
@@ -333,19 +333,19 @@ function AbCopyAddress()
var count = cards.length;
if (!count)
return;
var addresses = cards[0].primaryEmail;
for (var i = 1; i < count; i++)
addresses += "," + cards[i].primaryEmail;
- Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper)
- .copyString(addresses);
+ Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper)
+ .copyString(addresses);
}
/**
* Set up items in the View > Layout menupopup. This function is responsible
* for updating the menu items' state to reflect reality.
*
* @param aEvent the event that caused the View > Layout menupopup to be shown
*/
@@ -372,17 +372,17 @@ function GetSelectedAddressesFromDirTree
if (!selectedDir || !selectedDir.isMailList)
return "";
let listCardsCount = selectedDir.addressLists.length;
let cards = new Array(listCardsCount);
for (let i = 0; i < listCardsCount; ++i)
cards[i] = selectedDir.addressLists
- .queryElementAt(i, Components.interfaces.nsIAbCard);
+ .queryElementAt(i, Ci.nsIAbCard);
return GetAddressesForCards(cards);
}
// Generate a comma separated list of addresses from a given
// set of cards.
function GetAddressesForCards(cards)
{
var addresses = "";
@@ -648,21 +648,21 @@ function GetSelectedDirectory()
return getSelectedDirectoryURI();
}
/**
* Returns an nsIFile of the directory in which contact photos are stored.
* This will create the directory if it does not yet exist.
*/
function getPhotosDir() {
- var file = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
+ var file = Services.dirsvc.get("ProfD", Ci.nsIFile);
// Get the Photos directory
file.append("Photos");
if (!file.exists() || !file.isDirectory())
- file.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, parseInt("0777", 8));
+ file.create(Ci.nsIFile.DIRECTORY_TYPE, parseInt("0777", 8));
return file;
}
/**
* Returns a URI specifying the location of a photo based on its name.
* If the name is blank, or if the photo with that name is not in the Photos
* directory then the default photo URI is returned.
*
@@ -704,18 +704,18 @@ function storePhoto(aUri) {
// Get the photos directory and check that it exists
var file = getPhotosDir();
// Create a channel from the URI and open it as an input stream
var channel = Services.io.newChannelFromURI2(Services.io.newURI(aUri),
null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_INTERNAL_IMAGE);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE);
var istream = channel.open();
// Get the photo file
file = makePhotoFile(file, findPhotoExt(channel));
return IOUtils.saveStreamToFile(istream, file);
}
@@ -728,21 +728,21 @@ function storePhoto(aUri) {
* The original function can be called if the URI does not match.
*
* @param aUri The URI of the photo.
* @param aChannel The opened channel for the URI.
*
* @return The extension of the file, if any, including the period.
*/
function findPhotoExt(aChannel) {
- var mimeSvc = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService);
+ var mimeSvc = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService);
var ext = "";
var uri = aChannel.URI;
- if (uri instanceof Components.interfaces.nsIURL)
+ if (uri instanceof Ci.nsIURL)
ext = uri.fileExtension;
try {
return mimeSvc.getPrimaryExtension(aChannel.contentType, ext);
} catch (e) {}
return ext;
}
/**
--- a/suite/mailnews/addrbook/abSelectAddressesDialog.js
+++ b/suite/mailnews/addrbook/abSelectAddressesDialog.js
@@ -20,18 +20,18 @@ var prefixCc;
var prefixBcc;
var gToButton;
var gCcButton;
var gBccButton;
var gActivatedButton;
-var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"]
- .getService(Components.interfaces.nsIDragService);
+var gDragService = Cc["@mozilla.org/widget/dragservice;1"]
+ .getService(Ci.nsIDragService);
var gSelectAddressesAbViewListener = {
onSelectionChanged: function() {
ResultsPaneSelectionChanged();
},
onCountChanged: function(total) {
// do nothing
}
--- a/suite/mailnews/addrbook/abTrees.js
+++ b/suite/mailnews/addrbook/abTrees.js
@@ -46,17 +46,17 @@ abDirTreeItem.prototype =
{
if (!this._children)
{
this._children = [];
var myEnum = this._directory.childNodes;
while (myEnum.hasMoreElements())
{
var abItem = new abDirTreeItem(
- myEnum.getNext().QueryInterface(Components.interfaces.nsIAbDirectory));
+ myEnum.getNext().QueryInterface(Ci.nsIAbDirectory));
abItem._level = this._level + 1;
abItem._parent = this;
this._children.push(abItem);
}
// We sort children based on their names.
function nameSort(a, b)
{
@@ -152,34 +152,34 @@ directoryTreeView.prototype =
* this function.
*/
_rebuild: function dtv__rebuild() {
this._rowMap = [];
var dirEnum = MailServices.ab.directories;
while (dirEnum.hasMoreElements())
this._rowMap.push(new abDirTreeItem(
- dirEnum.getNext().QueryInterface(Components.interfaces.nsIAbDirectory)));
+ dirEnum.getNext().QueryInterface(Ci.nsIAbDirectory)));
// Sort our addressbooks now.
const AB_ORDER = ["pab", "mork", "ldap", "mapi+other", "cab"];
function getDirectoryValue(aDir, aKey)
{
if (aKey == "ab_type")
{
if (aDir._directory.URI == kPersonalAddressbookURI)
return "pab";
if (aDir._directory.URI == kCollectedAddressbookURI)
return "cab";
- if (aDir._directory instanceof Components.interfaces.nsIAbMDBDirectory)
+ if (aDir._directory instanceof Ci.nsIAbMDBDirectory)
return "mork";
if ("nsIAbLDAPDirectory" in Components.interfaces &&
- aDir._directory instanceof Components.interfaces.nsIAbLDAPDirectory)
+ aDir._directory instanceof Ci.nsIAbLDAPDirectory)
return "ldap";
return "mapi+other";
}
else if (aKey == "ab_name")
{
return aDir._directory.dirName;
}
}
@@ -224,17 +224,17 @@ directoryTreeView.prototype =
this._rowMap.sort(abSort);
this._restoreOpenStates();
},
// nsIAbListener interfaces
onItemAdded: function dtv_onItemAdded(aParent, aItem)
{
- if (!(aItem instanceof Components.interfaces.nsIAbDirectory))
+ if (!(aItem instanceof Ci.nsIAbDirectory))
return;
var oldCount = this._rowMap.length;
var tree = this._tree;
this._tree = null;
this._rebuild();
if (!tree)
return;
@@ -244,17 +244,17 @@ directoryTreeView.prototype =
tree.rowCountChanged(itemIndex, this._rowMap.length - oldCount);
var parentIndex = this.getIndexOfDirectory(aParent);
if (parentIndex > -1)
tree.invalidateRow(parentIndex);
},
onItemRemoved: function dtv_onItemRemoved(aParent, aItem)
{
- if (!(aItem instanceof Components.interfaces.nsIAbDirectory))
+ if (!(aItem instanceof Ci.nsIAbDirectory))
return;
var itemIndex = this.getIndexOfDirectory(aItem);
var oldCount = this._rowMap.length;
var tree = this._tree;
this._tree = null;
this._rebuild();
if (!tree)
@@ -279,17 +279,17 @@ directoryTreeView.prototype =
newIndex = 0;
this.selection.select(newIndex);
}
},
onItemPropertyChanged: function dtv_onItemProp(aItem, aProp, aOld, aNew)
{
- if (!(aItem instanceof Components.interfaces.nsIAbDirectory))
+ if (!(aItem instanceof Ci.nsIAbDirectory))
return;
var index = this.getIndexOfDirectory(aItem);
var current = this.getDirectoryAtIndex(this.selection.currentIndex);
var tree = this._tree;
this._tree = null;
this._rebuild();
this._tree = tree;
--- a/suite/mailnews/addrbook/addressbook.js
+++ b/suite/mailnews/addrbook/addressbook.js
@@ -2,17 +2,17 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource:///modules/ABQueryUtils.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
-const nsIAbListener = Components.interfaces.nsIAbListener;
+const nsIAbListener = Ci.nsIAbListener;
const kPrefMailAddrBookLastNameFirst = "mail.addr_book.lastnamefirst";
const kPersistCollapseMapStorage = "directoryTree.json";
var gSearchTimer = null;
var gStatusText = null;
var gQueryURIFormat = null;
var gSearchInput;
var gSearchBox;
@@ -87,19 +87,19 @@ function OnLoadAddressBook()
// directory item is/are removed. In the case of directory items, we are
// only really interested in mailing list changes and not cards but we have
// to have both.
MailServices.ab.addAddressBookListener(gDirectoryTreeView, nsIAbListener.all);
gDirTree.controllers.appendController(DirPaneController);
// Ensure we don't load xul error pages into the main window
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell)
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
.useErrorPages = false;
}
function GetCurrentPrefs()
{
// check "Show Name As" menu item based on pref
var menuitemID;
switch (Services.prefs.getIntPref(kPrefMailAddrBookLastNameFirst))
@@ -189,18 +189,18 @@ function AbPrintCardInternal(doPrintPrev
{
var selectedItems = GetSelectedAbCards();
var numSelected = selectedItems.length;
if (!numSelected)
return;
let statusFeedback;
- statusFeedback = Components.classes["@mozilla.org/messenger/statusfeedback;1"].createInstance();
- statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback);
+ statusFeedback = Cc["@mozilla.org/messenger/statusfeedback;1"].createInstance();
+ statusFeedback = statusFeedback.QueryInterface(Ci.nsIMsgStatusFeedback);
let selectionArray = [];
for (let i = 0; i < numSelected; i++) {
let card = selectedItems[i];
let printCardUrl = CreatePrintCardUrl(card);
if (printCardUrl) {
selectionArray.push(printCardUrl);
@@ -213,38 +213,38 @@ function AbPrintCardInternal(doPrintPrev
selectionArray.length, selectionArray,
statusFeedback, doPrintPreview, msgType);
return;
}
function AbPrintCard()
{
- AbPrintCardInternal(false, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_AB_CARD);
+ AbPrintCardInternal(false, Ci.nsIMsgPrintEngine.MNAB_PRINT_AB_CARD);
}
function AbPrintPreviewCard()
{
- AbPrintCardInternal(true, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_AB_CARD);
+ AbPrintCardInternal(true, Ci.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_AB_CARD);
}
function CreatePrintCardUrl(card)
{
return "data:application/xml;base64," + card.translateTo("base64xml");
}
function AbPrintAddressBookInternal(doPrintPreview, msgType)
{
let uri = getSelectedDirectoryURI();
if (!uri)
return;
var statusFeedback;
- statusFeedback = Components.classes["@mozilla.org/messenger/statusfeedback;1"].createInstance();
- statusFeedback = statusFeedback.QueryInterface(Components.interfaces.nsIMsgStatusFeedback);
+ statusFeedback = Cc["@mozilla.org/messenger/statusfeedback;1"].createInstance();
+ statusFeedback = statusFeedback.QueryInterface(Ci.nsIMsgStatusFeedback);
/*
turn "moz-abmdbdirectory://abook.mab" into
"addbook://moz-abmdbdirectory/abook.mab?action=print"
*/
var abURIArr = uri.split("://");
var printUrl = "addbook://" + abURIArr[0] + "/" + abURIArr[1] + "?action=print"
@@ -254,22 +254,22 @@ function AbPrintAddressBookInternal(doPr
"chrome,dialog=no,all",
1, [printUrl], statusFeedback, doPrintPreview, msgType);
return;
}
function AbPrintAddressBook()
{
- AbPrintAddressBookInternal(false, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_ADDRBOOK);
+ AbPrintAddressBookInternal(false, Ci.nsIMsgPrintEngine.MNAB_PRINT_ADDRBOOK);
}
function AbPrintPreviewAddressBook()
{
- AbPrintAddressBookInternal(true, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_ADDRBOOK);
+ AbPrintAddressBookInternal(true, Ci.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_ADDRBOOK);
}
/**
* Export the currently selected addressbook.
*/
function AbExportSelection() {
let selectedDirURI = getSelectedDirectoryURI();
if (!selectedDirURI)
@@ -310,20 +310,20 @@ function AbExport(aSelectedDirURI)
try {
let directory = GetDirectoryFromURI(aSelectedDirURI);
MailServices.ab.exportAddressBook(window, directory);
}
catch (ex) {
var message;
switch (ex.result) {
- case Components.results.NS_ERROR_FILE_ACCESS_DENIED:
+ case Cr.NS_ERROR_FILE_ACCESS_DENIED:
message = gAddressBookBundle.getString("failedToExportMessageFileAccessDenied");
break;
- case Components.results.NS_ERROR_FILE_NO_DEVICE_SPACE:
+ case Cr.NS_ERROR_FILE_NO_DEVICE_SPACE:
message = gAddressBookBundle.getString("failedToExportMessageNoDeviceSpace");
break;
default:
message = ex.message;
break;
}
Services.prompt.alert(window,
--- a/suite/mailnews/browserRequest.js
+++ b/suite/mailnews/browserRequest.js
@@ -1,27 +1,27 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
-const wpl = Components.interfaces.nsIWebProgressListener;
+const wpl = Ci.nsIWebProgressListener;
var reporterListener = {
_isBusy: false,
get securityButton() {
delete this.securityButton;
return this.securityButton = document.getElementById("security-button");
},
QueryInterface: function(aIID) {
- if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
- aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIWebProgressListener) ||
+ aIID.equals(Ci.nsISupportsWeakReference) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
onStateChange: function(/*in nsIWebProgress*/ aWebProgress,
/*in nsIRequest*/ aRequest,
/*in unsigned long*/ aStateFlags,
/*in nsresult*/ aStatus) {
},
@@ -98,16 +98,16 @@ function loadRequestedUrl()
let request = window.arguments[0].wrappedJSObject;
document.getElementById("headerMessage").textContent = request.promptText;
let account = request.account;
if (request.iconURI != "")
document.getElementById("headerImage").src = request.iconURI;
var browser = document.getElementById("requestFrame");
browser.addProgressListener(reporterListener,
- Components.interfaces.nsIWebProgress.NOTIFY_ALL);
+ Ci.nsIWebProgress.NOTIFY_ALL);
var url = request.url;
if (url != "") {
browser.setAttribute("src", url);
document.getElementById("headerMessage").textContent = url;
}
request.loaded(window, browser.webProgress);
}
--- a/suite/mailnews/commandglue.js
+++ b/suite/mailnews/commandglue.js
@@ -29,17 +29,17 @@ function OpenURL(url)
messenger.openURL(url);
}
function GetMsgFolderFromResource(folderResource)
{
if (!folderResource)
return null;
- var msgFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
+ var msgFolder = folderResource.QueryInterface(Ci.nsIMsgFolder);
if (msgFolder && (msgFolder.parent || msgFolder.isServer))
return msgFolder;
else
return null;
}
function GetServer(uri)
{
@@ -279,34 +279,34 @@ function RerootFolder(uri, newFolder, vi
//Set the window's new open folder.
msgWindow.openFolder = newFolder;
//the new folder being selected should have its biff state get cleared.
if(newFolder)
{
newFolder.biffState =
- Components.interfaces.nsIMsgFolder.nsMsgBiffState_NoMail;
+ Ci.nsIMsgFolder.nsMsgBiffState_NoMail;
}
//Clear out the thread pane so that we can sort it with the new sort id without taking any time.
// folder.setAttribute('ref', "");
// null this out, so we don't try sort.
if (gDBView) {
gDBView.close();
gDBView = null;
}
// cancel the pending mark as read timer
ClearPendingReadTimer();
// If this is the sent, drafts, templates, or send later folder,
// we show "Recipient" instead of "Author".
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
let outgoingFlags = nsMsgFolderFlags.SentMail | nsMsgFolderFlags.Drafts |
nsMsgFolderFlags.Templates | nsMsgFolderFlags.Queue;
SetSentFolderColumns(newFolder.isSpecialFolder(outgoingFlags, true));
ShowLocationColumn(viewType == nsMsgViewType.eShowVirtualFolderResults);
// Only show 'Received' column for e-mails. For newsgroup messages, the 'Date' header is as reliable as an e-mail's
// 'Received' header, as it is replaced with the news server's (more reliable) date.
UpdateReceivedColumn(newFolder);
@@ -448,17 +448,17 @@ function ShowLocationColumn(show)
}
function UpdateReceivedColumn(newFolder)
{
// Only show 'Received' column for e-mails. For newsgroup messages, the 'Date' header is as reliable as an e-mail's
// 'Received' header, as it is replaced with the news server's (more reliable) date.
var receivedColumn = document.getElementById("receivedCol");
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
var newFolderShowsRcvd = (newFolder.flags & nsMsgFolderFlags.Mail) &&
!(newFolder.flags & (nsMsgFolderFlags.Queue | nsMsgFolderFlags.Templates |
nsMsgFolderFlags.Drafts | nsMsgFolderFlags.SentMail));
var tempHidden = receivedColumn.getAttribute("temphidden") == "true";
var isHidden = receivedColumn.getAttribute("hidden") == "true";
if (!newFolderShowsRcvd && !isHidden)
@@ -596,22 +596,22 @@ function ConvertSortTypeToColumnID(sortK
default:
dump("unsupported sort key: " + sortKey + "\n");
columnID = null;
break;
}
return columnID;
}
-var nsMsgViewSortType = Components.interfaces.nsMsgViewSortType;
-var nsMsgViewSortOrder = Components.interfaces.nsMsgViewSortOrder;
-var nsMsgViewFlagsType = Components.interfaces.nsMsgViewFlagsType;
-var nsMsgViewCommandType = Components.interfaces.nsMsgViewCommandType;
-var nsMsgViewType = Components.interfaces.nsMsgViewType;
-var nsMsgNavigationType = Components.interfaces.nsMsgNavigationType;
+var nsMsgViewSortType = Ci.nsMsgViewSortType;
+var nsMsgViewSortOrder = Ci.nsMsgViewSortOrder;
+var nsMsgViewFlagsType = Ci.nsMsgViewFlagsType;
+var nsMsgViewCommandType = Ci.nsMsgViewCommandType;
+var nsMsgViewType = Ci.nsMsgViewType;
+var nsMsgNavigationType = Ci.nsMsgNavigationType;
var gDBView = null;
var gCurViewFlags;
var gCurSortType;
// CreateDBView is called when we have a thread pane. CreateBareDBView is called when there is no
// tree associated with the view. CreateDBView will call into CreateBareDBView...
@@ -644,32 +644,32 @@ function CreateBareDBView(originalView,
dbviewContractId += "group";
else
dbviewContractId += "threaded";
break;
}
// dump ("contract id = " + dbviewContractId + "original view = " + originalView + "\n");
if (!originalView)
- gDBView = Components.classes[dbviewContractId].createInstance(Components.interfaces.nsIMsgDBView);
+ gDBView = Cc[dbviewContractId].createInstance(Ci.nsIMsgDBView);
gCurViewFlags = viewFlags;
var count = new Object;
if (!gThreadPaneCommandUpdater)
gThreadPaneCommandUpdater = new nsMsgDBViewCommandUpdater();
gCurSortType = sortType;
if (!originalView) {
gDBView.init(messenger, msgWindow, gThreadPaneCommandUpdater);
gDBView.open(msgFolder, gCurSortType, sortOrder, viewFlags, count);
if (viewType == nsMsgViewType.eShowVirtualFolderResults)
{
// the view is a listener on the search results
- gViewSearchListener = gDBView.QueryInterface(Components.interfaces.nsIMsgSearchNotify);
+ gViewSearchListener = gDBView.QueryInterface(Ci.nsIMsgSearchNotify);
gSearchSession.registerListener(gViewSearchListener);
}
}
else {
gDBView = originalView.cloneDBView(messenger, msgWindow, gThreadPaneCommandUpdater);
}
}
@@ -720,17 +720,17 @@ function FolderPaneSelectionChange()
return;
// If msgFolder turns out to be a single folder saved search, not a virtual folder,
// realFolder will get set to the underlying folder the saved search is based on.
let realFolder = msgFolder;
gPrevSelectedFolder = gMsgFolderSelected;
gMsgFolderSelected = msgFolder;
UpdateLocationBar(gMsgFolderSelected);
var folderFlags = msgFolder.flags;
- const kVirtual = Components.interfaces.nsMsgFolderFlags.Virtual;
+ const kVirtual = Ci.nsMsgFolderFlags.Virtual;
// if this is same folder, and we're not showing a virtual folder
// then do nothing.
if (msgFolder == msgWindow.openFolder &&
!(folderFlags & kVirtual) && !(gPrevFolderFlags & kVirtual))
return;
OnLeavingFolder(gPrevSelectedFolder); // mark all read in last folder
var sortType = 0;
@@ -762,17 +762,17 @@ function FolderPaneSelectionChange()
viewType = nsMsgViewType.eShowQuickSearchResults;
var searchTermString = dbFolderInfo.getCharProperty("searchStr");
// trick the view code into updating the real folder...
gCurrentVirtualFolderUri = uriToLoad;
var srchFolderUri = dbFolderInfo.getCharProperty("searchFolderUri");
var srchFolderUriArray = srchFolderUri.split('|');
var searchOnline = dbFolderInfo.getBooleanProperty("searchOnline", false);
// cross folder search
- var filterService = Components.classes["@mozilla.org/messenger/services/filters;1"].getService(Components.interfaces.nsIMsgFilterService);
+ var filterService = Cc["@mozilla.org/messenger/services/filters;1"].getService(Ci.nsIMsgFilterService);
var filterList = filterService.getTempFilterList(msgFolder);
var tempFilter = filterList.createFilter("temp");
filterList.parseCondition(tempFilter, searchTermString);
if (srchFolderUriArray.length > 1)
{
viewType = nsMsgViewType.eShowVirtualFolderResults;
gXFVirtualFolderTerms = CreateGroupedSearchTerms(tempFilter.searchTerms);
setupXFVirtualFolderSearch(srchFolderUriArray, gXFVirtualFolderTerms, searchOnline);
@@ -875,17 +875,17 @@ function RemoveMailOfflineObserver()
function getSearchTermString(searchTerms)
{
var searchIndex;
var condition = "";
var count = searchTerms.Count();
for (searchIndex = 0; searchIndex < count; )
{
- var term = searchTerms.queryElementAt(searchIndex++, Components.interfaces.nsIMsgSearchTerm);
+ var term = searchTerms.queryElementAt(searchIndex++, Ci.nsIMsgSearchTerm);
if (condition.length > 1)
condition += ' ';
if (term.matchAll)
{
condition = "ALL";
break;
@@ -899,33 +899,33 @@ function getSearchTermString(searchTerms
function CreateVirtualFolder(newName, parentFolder, searchFolderURIs, searchTerms, searchOnline)
{
// ### need to make sure view/folder doesn't exist.
if (searchFolderURIs && (searchFolderURIs != "") && newName && (newName != ""))
{
var newFolder;
try
{
- if (parentFolder instanceof(Components.interfaces.nsIMsgLocalMailFolder))
+ if (parentFolder instanceof(Ci.nsIMsgLocalMailFolder))
newFolder = parentFolder.createLocalSubfolder(newName);
else
newFolder = parentFolder.addSubfolder(newName);
- newFolder.setFlag(Components.interfaces.nsMsgFolderFlags.Virtual);
+ newFolder.setFlag(Ci.nsMsgFolderFlags.Virtual);
var vfdb = newFolder.msgDatabase;
var searchTermString = getSearchTermString(searchTerms);
var dbFolderInfo = vfdb.dBFolderInfo;
// set the view string as a property of the db folder info
// set the original folder name as well.
dbFolderInfo.setCharProperty("searchStr", searchTermString);
dbFolderInfo.setCharProperty("searchFolderUri", searchFolderURIs);
dbFolderInfo.setBooleanProperty("searchOnline", searchOnline);
vfdb.summaryValid = true;
vfdb.Close(true);
parentFolder.NotifyItemAdded(newFolder);
- var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
+ var accountManager = Cc["@mozilla.org/messenger/account-manager;1"].getService(Ci.nsIMsgAccountManager);
accountManager.saveVirtualFolders();
}
catch(e)
{
throw(e); // so that the dialog does not automatically close
dump ("Exception : creating virtual folder \n");
}
}
@@ -934,19 +934,19 @@ function CreateVirtualFolder(newName, p
dump("no name or nothing selected\n");
}
}
var searchSessionContractID = "@mozilla.org/messenger/searchSession;1";
var gSearchView;
var gSearchSession;
-var nsIMsgFolder = Components.interfaces.nsIMsgFolder;
-var nsIMsgWindow = Components.interfaces.nsIMsgWindow;
-var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
+var nsIMsgFolder = Ci.nsIMsgFolder;
+var nsIMsgWindow = Ci.nsIMsgWindow;
+var nsMsgSearchScope = Ci.nsMsgSearchScope;
var gFolderDatasource;
var gFolderPicker;
var gStatusBar = null;
var gTimelineEnabled = false;
var gMessengerBundle = null;
// Datasource search listener -- made global as it has to be registered
@@ -961,55 +961,55 @@ function GetScopeForFolder(folder)
return folder.server.searchScope;
}
function setupXFVirtualFolderSearch(folderUrisToSearch, searchTerms, searchOnline)
{
var count = new Object;
var i;
- gSearchSession = Components.classes[searchSessionContractID].createInstance(Components.interfaces.nsIMsgSearchSession);
+ gSearchSession = Cc[searchSessionContractID].createInstance(Ci.nsIMsgSearchSession);
- gMailSession = Components.classes["@mozilla.org/messenger/services/session;1"]
- .getService(Components.interfaces.nsIMsgMailSession);
+ gMailSession = Cc["@mozilla.org/messenger/services/session;1"]
+ .getService(Ci.nsIMsgMailSession);
for (i in folderUrisToSearch)
{
let realFolder = GetMsgFolderFromUri(folderUrisToSearch[i]);
if (!realFolder.isServer)
gSearchSession.addScopeTerm(!searchOnline ? nsMsgSearchScope.offlineMail : GetScopeForFolder(realFolder), realFolder);
}
- const nsIMsgSearchTerm = Components.interfaces.nsIMsgSearchTerm;
+ const nsIMsgSearchTerm = Ci.nsIMsgSearchTerm;
for (let term of fixIterator(searchTerms, nsIMsgSearchTerm)) {
gSearchSession.appendTerm(term);
}
}
/**
* Uses an array of search terms to produce a new list usable from quick search.
*
* @param searchTermsArray A nsIArray of terms to copy.
*
* @return nsIMutableArray of search terms
*/
function CreateGroupedSearchTerms(searchTermsArray)
{
var searchSession = gSearchSession ||
- Components.classes[searchSessionContractID].createInstance(Components.interfaces.nsIMsgSearchSession);
+ Cc[searchSessionContractID].createInstance(Ci.nsIMsgSearchSession);
// Create a temporary nsIMutableArray to store our search terms
// since we will be modifying the terms so they work with quick search.
- var searchTermsArrayForQS = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var searchTermsArrayForQS = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
var numEntries = searchTermsArray.length;
for (let i = 0; i < numEntries; i++) {
- let searchTerm = searchTermsArray.queryElementAt(i, Components.interfaces.nsIMsgSearchTerm);
+ let searchTerm = searchTermsArray.queryElementAt(i, Ci.nsIMsgSearchTerm);
// clone the term, since we might be modifying it
var searchTermForQS = searchSession.createTerm();
searchTermForQS.value = searchTerm.value;
searchTermForQS.attrib = searchTerm.attrib;
searchTermForQS.arbitraryHeader = searchTerm.arbitraryHeader
searchTermForQS.hdrProperty = searchTerm.hdrProperty;
searchTermForQS.customId = searchTerm.customId
--- a/suite/mailnews/compose/EdColorPropsOverlay.xul
+++ b/suite/mailnews/compose/EdColorPropsOverlay.xul
@@ -9,17 +9,17 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript">
<![CDATA[
function onAccept() {
// If it's a file, convert to a data URL.
if (gBackgroundImage && /^file:/i.test(gBackgroundImage)) {
let nsFile = Services.io.newURI(gBackgroundImage)
- .QueryInterface(Components.interfaces.nsIFileURL)
+ .QueryInterface(Ci.nsIFileURL)
.file;
if (nsFile.exists()) {
let reader = new FileReader();
reader.addEventListener("load", function() {
gBackgroundImage = reader.result;
gDialog.BackgroundImageInput.value = reader.result;
if (onAccept()) {
window.close();
--- a/suite/mailnews/compose/MsgComposeCommands.js
+++ b/suite/mailnews/compose/MsgComposeCommands.js
@@ -9,49 +9,49 @@ ChromeUtils.import("resource://gre/modul
ChromeUtils.import("resource://gre/modules/InlineSpellChecker.jsm");
ChromeUtils.import("resource:///modules/folderUtils.jsm");
ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
/**
* interfaces
*/
-var nsIMsgCompDeliverMode = Components.interfaces.nsIMsgCompDeliverMode;
-var nsIMsgCompSendFormat = Components.interfaces.nsIMsgCompSendFormat;
-var nsIMsgCompConvertible = Components.interfaces.nsIMsgCompConvertible;
-var nsIMsgCompType = Components.interfaces.nsIMsgCompType;
-var nsIMsgCompFormat = Components.interfaces.nsIMsgCompFormat;
-var nsIAbPreferMailFormat = Components.interfaces.nsIAbPreferMailFormat;
-var nsIPlaintextEditorMail = Components.interfaces.nsIPlaintextEditor;
-var mozISpellCheckingEngine = Components.interfaces.mozISpellCheckingEngine;
+var nsIMsgCompDeliverMode = Ci.nsIMsgCompDeliverMode;
+var nsIMsgCompSendFormat = Ci.nsIMsgCompSendFormat;
+var nsIMsgCompConvertible = Ci.nsIMsgCompConvertible;
+var nsIMsgCompType = Ci.nsIMsgCompType;
+var nsIMsgCompFormat = Ci.nsIMsgCompFormat;
+var nsIAbPreferMailFormat = Ci.nsIAbPreferMailFormat;
+var nsIPlaintextEditorMail = Ci.nsIPlaintextEditor;
+var mozISpellCheckingEngine = Ci.mozISpellCheckingEngine;
/**
* In order to distinguish clearly globals that are initialized once when js load (static globals) and those that need to be
* initialize every time a compose window open (globals), I (ducarroz) have decided to prefix by s... the static one and
* by g... the other one. Please try to continue and repect this rule in the future. Thanks.
*/
/**
* static globals, need to be initialized only once
*/
-var sMsgComposeService = Components.classes["@mozilla.org/messengercompose;1"].getService(Components.interfaces.nsIMsgComposeService);
+var sMsgComposeService = Cc["@mozilla.org/messengercompose;1"].getService(Ci.nsIMsgComposeService);
var sComposeMsgsBundle;
var sBrandBundle;
var sRDF = null;
var sNameProperty = null;
var sDictCount = 0;
/* Create message window object. This is use by mail-offline.js and therefore should not be renamed. We need to avoid doing
this kind of cross file global stuff in the future and instead pass this object as parameter when needed by function
in the other js file.
*/
-var msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
-var gMessenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+var msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
+ .createInstance(Ci.nsIMsgWindow);
+var gMessenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
/**
* Global variables, need to be re-initialized every time mostly because we need to release them when the window close
*/
var gHideMenus;
var gMsgCompose;
var gOriginalMsgURI;
var gAccountManager;
@@ -88,33 +88,33 @@ var gAutoSaveInterval;
var gAutoSaveTimeout;
var gAutoSaveKickedIn;
var gEditingDraft;
var kComposeAttachDirPrefName = "mail.compose.attach.dir";
function InitializeGlobalVariables()
{
- gAccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
+ gAccountManager = Cc["@mozilla.org/messenger/account-manager;1"].getService(Ci.nsIMsgAccountManager);
gMsgCompose = null;
gOriginalMsgURI = null;
gWindowLocked = false;
gContentChanged = false;
gCurrentIdentity = null;
defaultSaveOperation = "draft";
gSendOrSaveOperationInProgress = false;
gAutoSaving = false;
gCloseWindowAfterSave = false;
gSavedSendNowKey = null;
gSendFormat = nsIMsgCompSendFormat.AskUser;
gSendDefaultCharset = null;
gCharsetTitle = null;
- gCharsetConvertManager = Components.classes['@mozilla.org/charset-converter-manager;1'].getService(Components.interfaces.nsICharsetConverterManager);
- gMailSession = Components.classes["@mozilla.org/messenger/services/session;1"].getService(Components.interfaces.nsIMsgMailSession);
+ gCharsetConvertManager = Cc['@mozilla.org/charset-converter-manager;1'].getService(Ci.nsICharsetConverterManager);
+ gMailSession = Cc["@mozilla.org/messenger/services/session;1"].getService(Ci.nsIMsgMailSession);
gHideMenus = false;
// We are storing the value of the bool logComposePerformance inorder to avoid logging unnecessarily.
if (sMsgComposeService)
gLogComposePerformance = sMsgComposeService.logComposePerformance;
gLastWindowToHaveFocus = null;
gReceiptOptionChanged = false;
gDSNOptionChanged = false;
@@ -168,33 +168,33 @@ var stateListener = {
this.useParagraph = gMsgCompose.composeHTML &&
Services.prefs.getBoolPref("mail.compose.default_to_paragraph");
this.editor = GetCurrentEditor();
this.paragraphState = document.getElementById("cmd_paragraphState");
// Look at the compose types which require action (nsIMsgComposeParams.idl):
switch (gComposeType) {
- case Components.interfaces.nsIMsgCompType.New:
- case Components.interfaces.nsIMsgCompType.NewsPost:
- case Components.interfaces.nsIMsgCompType.ForwardAsAttachment:
+ case Ci.nsIMsgCompType.New:
+ case Ci.nsIMsgCompType.NewsPost:
+ case Ci.nsIMsgCompType.ForwardAsAttachment:
this.NotifyComposeBodyReadyNew();
break;
- case Components.interfaces.nsIMsgCompType.Reply:
- case Components.interfaces.nsIMsgCompType.ReplyAll:
- case Components.interfaces.nsIMsgCompType.ReplyToSender:
- case Components.interfaces.nsIMsgCompType.ReplyToGroup:
- case Components.interfaces.nsIMsgCompType.ReplyToSenderAndGroup:
- case Components.interfaces.nsIMsgCompType.ReplyWithTemplate:
- case Components.interfaces.nsIMsgCompType.ReplyToList:
+ case Ci.nsIMsgCompType.Reply:
+ case Ci.nsIMsgCompType.ReplyAll:
+ case Ci.nsIMsgCompType.ReplyToSender:
+ case Ci.nsIMsgCompType.ReplyToGroup:
+ case Ci.nsIMsgCompType.ReplyToSenderAndGroup:
+ case Ci.nsIMsgCompType.ReplyWithTemplate:
+ case Ci.nsIMsgCompType.ReplyToList:
this.NotifyComposeBodyReadyReply();
break;
- case Components.interfaces.nsIMsgCompType.ForwardInline:
+ case Ci.nsIMsgCompType.ForwardInline:
this.NotifyComposeBodyReadyForwardInline();
break;
}
// Set the selected item in the identity list as needed, which will cause
// an identity/signature switch. This can only be done once the message
// body has already been assembled with the signature we need to switch.
if (gMsgCompose.identity != gCurrentIdentity) {
@@ -316,26 +316,26 @@ var stateListener = {
this.editor.resetModificationCount();
},
ComposeProcessDone: function(aResult) {
gWindowLocked = false;
enableEditableFields();
updateComposeItems();
- if (aResult== Components.results.NS_OK)
+ if (aResult== Cr.NS_OK)
{
if (!gAutoSaving)
SetContentAndBodyAsUnmodified();
if (gCloseWindowAfterSave)
{
// Notify the SendListener that Send has been aborted and Stopped
if (gMsgCompose)
- gMsgCompose.onSendNotPerformed(null, Components.results.NS_ERROR_ABORT);
+ gMsgCompose.onSendNotPerformed(null, Cr.NS_ERROR_ABORT);
MsgComposeCloseWindow();
}
}
// else if we failed to save, and we're autosaving, need to re-mark the editor
// as changed, so that we won't lose the changes.
else if (gAutoSaving)
{
@@ -351,24 +351,24 @@ var stateListener = {
DisplaySaveFolderDlg(folderURI);
}
};
// all progress notifications are done through the nsIWebProgressListener implementation...
var progressListener = {
onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus)
{
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_START)
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_START)
{
document.getElementById('navigator-throbber').setAttribute("busy", "true");
document.getElementById('compose-progressmeter').setAttribute( "mode", "undetermined" );
document.getElementById("statusbar-progresspanel").collapsed = false;
}
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP)
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP)
{
gSendOrSaveOperationInProgress = false;
document.getElementById('navigator-throbber').removeAttribute("busy");
document.getElementById('compose-progressmeter').setAttribute( "mode", "normal" );
document.getElementById('compose-progressmeter').setAttribute( "value", 0 );
document.getElementById("statusbar-progresspanel").collapsed = true;
document.getElementById('statusText').setAttribute('label', '');
}
@@ -414,22 +414,22 @@ var progressListener = {
onSecurityChange: function(aWebProgress, aRequest, state)
{
// we can ignore this notification
},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIWebProgressListener) ||
- iid.equals(Components.interfaces.nsISupportsWeakReference) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIWebProgressListener) ||
+ iid.equals(Ci.nsISupportsWeakReference) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
};
var defaultController =
{
supportsCommand: function(command)
{
switch (command)
@@ -746,17 +746,17 @@ var messageComposeOfflineQuitObserver =
// sanity checks
if (aTopic == "network:offline-status-changed")
{
MessageComposeOfflineStateChanged(aState == "offline");
}
// check whether to veto the quit request (unless another observer already
// did)
else if (aTopic == "quit-application-requested" &&
- aSubject instanceof Components.interfaces.nsISupportsPRBool &&
+ aSubject instanceof Ci.nsISupportsPRBool &&
!aSubject.data)
aSubject.data = !ComposeCanClose();
}
}
function AddMessageComposeOfflineQuitObserver()
{
Services.obs.addObserver(messageComposeOfflineQuitObserver,
@@ -807,17 +807,17 @@ function MessageComposeOfflineStateChang
} catch(e) {}
}
function DoCommandClose()
{
if (ComposeCanClose()) {
// Notify the SendListener that Send has been aborted and Stopped
if (gMsgCompose)
- gMsgCompose.onSendNotPerformed(null, Components.results.NS_ERROR_ABORT);
+ gMsgCompose.onSendNotPerformed(null, Cr.NS_ERROR_ABORT);
// note: if we're not caching this window, this destroys it for us
MsgComposeCloseWindow();
}
return false;
}
@@ -1054,46 +1054,46 @@ function onPasteOrDrop(e) {
if (!gMsgCompose.composeHTML) {
// We're in the plain text editor. Nothing to do here.
return;
}
let html = dataTransfer.getData("text/html");
let doc = (new DOMParser()).parseFromString(html, "text/html");
- let tmpD = Services.dirsvc.get("TmpD", Components.interfaces.nsIFile);
+ let tmpD = Services.dirsvc.get("TmpD", Ci.nsIFile);
let pendingConversions = 0;
let needToPreventDefault = true;
for (let img of doc.images) {
if (!/^file:/i.test(img.src)) {
// Doesn't start with file:. Nothing to do here.
continue;
}
// This may throw if the URL is invalid for the OS.
let nsFile;
try {
nsFile = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler)
+ .QueryInterface(Ci.nsIFileProtocolHandler)
.getFileFromURLSpec(img.src);
} catch (ex) {
continue;
}
if (!nsFile.exists()) {
continue;
}
if (!tmpD.contains(nsFile)) {
// Not anywhere under the temp dir.
continue;
}
- let contentType = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService)
+ let contentType = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService)
.getTypeFromFile(nsFile);
if (!contentType.startsWith("image/")) {
continue;
}
// If we ever get here, we need to prevent the default paste or drop since
// the code below will do its own insertion.
if (needToPreventDefault) {
@@ -1106,18 +1106,18 @@ function onPasteOrDrop(e) {
// Not put in temp in the last minute. May be something other than
// a copy-paste. Let's not allow that.
return;
}
let doTheInsert = function() {
// Now run it through sanitation to make sure there wasn't any
// unwanted things in the content.
- let ParserUtils = Components.classes["@mozilla.org/parserutils;1"]
- .getService(Components.interfaces.nsIParserUtils);
+ let ParserUtils = Cc["@mozilla.org/parserutils;1"]
+ .getService(Ci.nsIParserUtils);
let html2 = ParserUtils.sanitize(doc.documentElement.innerHTML,
ParserUtils.SanitizerAllowStyle);
getBrowser().contentDocument.execCommand("insertHTML", false, html2);
}
// Everything checks out. Convert file to data URL.
let reader = new FileReader();
reader.addEventListener("load", function() {
@@ -1146,17 +1146,17 @@ function ComposeStartup(aParams)
{
var params = null; // New way to pass parameters to the compose window as a nsIMsgComposeParameters object
var args = null; // old way, parameters are passed as a string
if (aParams)
params = aParams;
else if (window.arguments && window.arguments[0]) {
try {
- if (window.arguments[0] instanceof Components.interfaces.nsIMsgComposeParams)
+ if (window.arguments[0] instanceof Ci.nsIMsgComposeParams)
params = window.arguments[0];
else
params = handleMailtoArgs(window.arguments[0]);
}
catch(ex) { dump("ERROR with parameters: " + ex + "\n"); }
// if still no dice, try and see if the params is an old fashioned list of string attributes
// XXX can we get rid of this yet?
@@ -1176,20 +1176,20 @@ function ComposeStartup(aParams)
document.addEventListener("drop", onPasteOrDrop);
if (identityList)
FillIdentityList(identityList);
if (!params) {
// This code will go away soon as now arguments are passed to the window
// using a object of type nsMsgComposeParams instead of a string.
- params = Components.classes["@mozilla.org/messengercompose/composeparams;1"]
- .createInstance(Components.interfaces.nsIMsgComposeParams);
- params.composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
- .createInstance(Components.interfaces.nsIMsgCompFields);
+ params = Cc["@mozilla.org/messengercompose/composeparams;1"]
+ .createInstance(Ci.nsIMsgComposeParams);
+ params.composeFields = Cc["@mozilla.org/messengercompose/composefields;1"]
+ .createInstance(Ci.nsIMsgCompFields);
if (args) { //Convert old fashion arguments into params
var composeFields = params.composeFields;
if (args.bodyislink == "true")
params.bodyIsLink = true;
if (args.type)
params.type = args.type;
if (args.format)
@@ -1206,26 +1206,26 @@ function ComposeStartup(aParams)
composeFields.bcc = args.bcc;
if (args.newsgroups)
composeFields.newsgroups = args.newsgroups;
if (args.subject)
composeFields.subject = args.subject;
if (args.attachment)
{
var attachmentList = args.attachment.split(",");
- var commandLine = Components.classes["@mozilla.org/toolkit/command-line;1"]
- .createInstance();
+ var commandLine = Cc["@mozilla.org/toolkit/command-line;1"]
+ .createInstance();
for (let i = 0; i < attachmentList.length; i++)
{
let attachmentStr = attachmentList[i];
let uri = commandLine.resolveURI(attachmentStr);
- let attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"]
- .createInstance(Components.interfaces.nsIMsgAttachment);
-
- if (uri instanceof Components.interfaces.nsIFileURL)
+ let attachment = Cc["@mozilla.org/messengercompose/attachment;1"]
+ .createInstance(Ci.nsIMsgAttachment);
+
+ if (uri instanceof Ci.nsIFileURL)
{
if (uri.file.exists())
attachment.size = uri.file.fileSize;
else
attachment = null;
}
// Only want to attach if a file that exists or it is not a file.
@@ -1253,17 +1253,17 @@ function ComposeStartup(aParams)
gComposeType = params.type;
// An identity with no email is likely not valid.
if (!params.identity || !params.identity.email) {
// no pre selected identity, so use the default account
var identities = gAccountManager.defaultAccount.identities;
if (identities.length == 0)
identities = gAccountManager.allIdentities;
- params.identity = identities.queryElementAt(0, Components.interfaces.nsIMsgIdentity);
+ params.identity = identities.queryElementAt(0, Ci.nsIMsgIdentity);
}
identityList.selectedItem =
identityList.getElementsByAttribute("identitykey", params.identity.key)[0];
if (params.composeFields.from)
identityList.value = MailServices.headerParser.parseDecodedHeader(params.composeFields.from)[0].toString();
LoadIdentity(true);
if (sMsgComposeService)
@@ -1339,17 +1339,17 @@ function ComposeStartup(aParams)
msgCompFields.body = "\n<" + body + ">\n";
}
var subjectValue = msgCompFields.subject;
GetMsgSubjectElement().value = subjectValue;
var attachments = msgCompFields.attachments;
while (attachments.hasMoreElements()) {
- AddAttachment(attachments.getNext().QueryInterface(Components.interfaces.nsIMsgAttachment));
+ AddAttachment(attachments.getNext().QueryInterface(Ci.nsIMsgAttachment));
}
}
var event = document.createEvent('Events');
event.initEvent('compose-window-init', false, true);
document.getElementById("msgcomposeWindow").dispatchEvent(event);
gMsgCompose.RegisterStateListener(stateListener);
@@ -1372,20 +1372,20 @@ function ComposeStartup(aParams)
}
}
// create URI of the folder from draftId
var draftId = msgCompFields.draftId;
var folderURI = draftId.substring(0, draftId.indexOf("#")).replace("-message", "");
try {
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
var folder = sRDF.GetResource(folderURI);
- gEditingDraft = (folder instanceof Components.interfaces.nsIMsgFolder) &&
+ gEditingDraft = (folder instanceof Ci.nsIMsgFolder) &&
(folder.flags & nsMsgFolderFlags.Drafts);
}
catch (ex) {
gEditingDraft = false;
}
gAutoSaveKickedIn = false;
@@ -1402,17 +1402,17 @@ var gMsgEditorCreationObserver =
{
observe: function(aSubject, aTopic, aData)
{
if (aTopic == "obs_documentCreated")
{
var editor = GetCurrentEditor();
var commandManager = GetCurrentCommandManager();
if (editor && commandManager == aSubject) {
- let editorStyle = editor.QueryInterface(Components.interfaces.nsIEditorStyleSheets);
+ let editorStyle = editor.QueryInterface(Ci.nsIEditorStyleSheets);
// We use addOverrideStyleSheet rather than addStyleSheet so that we get
// a synchronous load, rather than having a late-finishing async load
// mark our editor as modified when the user hasn't typed anything yet,
// but that means the sheet must not @import slow things, especially
// not over the network.
editorStyle.addOverrideStyleSheet("chrome://messenger/skin/messageQuotes.css");
InitEditor(editor);
}
@@ -1441,18 +1441,18 @@ function WizCallback(state)
function ComposeLoad()
{
sComposeMsgsBundle = document.getElementById("bundle_composeMsgs");
sBrandBundle = document.getElementById("brandBundle");
var otherHeaders = getPref("mail.compose.other.header");
- sRDF = Components.classes['@mozilla.org/rdf/rdf-service;1']
- .getService(Components.interfaces.nsIRDFService);
+ sRDF = Cc['@mozilla.org/rdf/rdf-service;1']
+ .getService(Ci.nsIRDFService);
sNameProperty = sRDF.GetResource("http://home.netscape.com/NC-rdf#Name?sort=true");
AddMessageComposeOfflineQuitObserver();
if (gLogComposePerformance)
sMsgComposeService.TimeStamp("Start initializing the compose window (ComposeLoad)", false);
try {
@@ -1466,17 +1466,17 @@ function ComposeLoad()
var otherHeaders_Array = otherHeaders.split(",");
for (let i = 0; i < otherHeaders_Array.length; i++)
selectNode.appendItem(otherHeaders_Array[i] + ":", "addr_other");
}
if (state)
ComposeStartup(null);
}
catch (ex) {
- Components.utils.reportError(ex);
+ Cu.reportError(ex);
var errorTitle = sComposeMsgsBundle.getString("initErrorDlogTitle");
var errorMsg = sComposeMsgsBundle.getString("initErrorDlgMessage");
Services.prompt.alert(window, errorTitle, errorMsg);
MsgComposeCloseWindow();
return;
}
if (gLogComposePerformance)
@@ -1750,34 +1750,34 @@ function GenericSendMessage( msgType )
// just before we try to send the message, fire off the compose-send-message event for listeners
// such as smime so they can do any pre-security work such as fetching certificates before sending
var event = document.createEvent('UIEvents');
event.initEvent('compose-send-message', false, true);
var msgcomposeWindow = document.getElementById("msgcomposeWindow");
msgcomposeWindow.setAttribute("msgtype", msgType);
msgcomposeWindow.dispatchEvent(event);
if (event.defaultPrevented)
- throw Components.results.NS_ERROR_ABORT;
+ throw Cr.NS_ERROR_ABORT;
gAutoSaving = msgType == nsIMsgCompDeliverMode.AutoSaveAsDraft;
// if we're auto saving, mark the body as not changed here, and not
// when the save is done, because the user might change it between now
// and when the save is done.
if (gAutoSaving)
{
SetContentAndBodyAsUnmodified();
}
else
{
// disable the ui if we're not auto-saving
gWindowLocked = true;
disableEditableFields();
updateComposeItems();
}
- var progress = Components.classes["@mozilla.org/messenger/progress;1"].createInstance(Components.interfaces.nsIMsgProgress);
+ var progress = Cc["@mozilla.org/messenger/progress;1"].createInstance(Ci.nsIMsgProgress);
if (progress)
{
progress.registerListener(progressListener);
gSendOrSaveOperationInProgress = true;
}
msgWindow.domWindow = window;
msgWindow.rootDocShell.allowAuth = true;
gMsgCompose.SendMsg(msgType, getCurrentIdentity(), currentAccountKey, msgWindow, progress);
@@ -2007,17 +2007,17 @@ function SelectAddress()
}
// walk through the recipients list and add them to the inline spell checker ignore list
function addRecipientsToIgnoreList(aAddressesToAdd)
{
if (InlineSpellCheckerUI.enabled)
{
// break the list of potentially many recipients back into individual names
- var hdrParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser);
+ var hdrParser = Cc["@mozilla.org/messenger/headerparser;1"].getService(Ci.nsIMsgHeaderParser);
var emailAddresses = {};
var names = {};
var fullNames = {};
var numAddresses = hdrParser.parseHeadersWithArray(aAddressesToAdd, emailAddresses, names, fullNames);
var tokenizedNames = [];
// each name could consist of multiple words delimited by commas and/or spaces.
// i.e. Green Lantern or Lantern,Green.
@@ -2049,18 +2049,18 @@ function addRecipientsToIgnoreList(aAddr
}
function InitLanguageMenu()
{
var languageMenuList = document.getElementById("languageMenuList");
if (!languageMenuList)
return;
- var spellChecker = Components.classes["@mozilla.org/spellchecker/engine;1"]
- .getService(mozISpellCheckingEngine);
+ var spellChecker = Cc["@mozilla.org/spellchecker/engine;1"]
+ .getService(mozISpellCheckingEngine);
var o1 = {};
var o2 = {};
// Get the list of dictionaries from the spellchecker.
spellChecker.getDictionaryList(o1, o2);
var dictList = o1.value;
var count = o2.value;
@@ -2205,17 +2205,17 @@ function ToggleAttachVCard(target)
function FillIdentityList(menulist)
{
var accounts = allAccountsSorted(true);
for (let acc = 0; acc < accounts.length; acc++)
{
let account = accounts[acc];
let identities = toArray(fixIterator(account.identities,
- Components.interfaces.nsIMsgIdentity));
+ Ci.nsIMsgIdentity));
if (identities.length == 0)
continue;
for (let i = 0; i < identities.length; i++)
{
let identity = identities[i];
let item = menulist.appendItem(identity.identityName,
@@ -2352,27 +2352,27 @@ function ComposeCanClose()
function RemoveDraft()
{
try
{
var draftId = gMsgCompose.compFields.draftId;
var msgKey = draftId.substr(draftId.indexOf('#') + 1);
var folder = sRDF.GetResource(gMsgCompose.savedFolderURI);
try {
- if (folder instanceof Components.interfaces.nsIMsgFolder)
+ if (folder instanceof Ci.nsIMsgFolder)
{
- var msgs = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var msgs = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
msgs.appendElement(folder.GetMessageHeader(msgKey));
folder.deleteMessages(msgs, null, true, false, null, false);
}
}
catch (ex) // couldn't find header - perhaps an imap folder.
{
- if (folder instanceof Components.interfaces.nsIMsgImapMailFolder)
+ if (folder instanceof Ci.nsIMsgImapMailFolder)
{
const kImapMsgDeletedFlag = 0x0008;
folder.storeImapFlags(kImapMsgDeletedFlag, true, [msgKey], 1, null);
}
}
} catch (ex) {}
}
@@ -2389,32 +2389,32 @@ function MsgComposeCloseWindow()
else
window.close();
}
// attachedLocalFile must be a nsIFile
function SetLastAttachDirectory(attachedLocalFile)
{
try {
- var file = attachedLocalFile.QueryInterface(Components.interfaces.nsIFile);
- var parent = file.parent.QueryInterface(Components.interfaces.nsIFile);
+ var file = attachedLocalFile.QueryInterface(Ci.nsIFile);
+ var parent = file.parent.QueryInterface(Ci.nsIFile);
Services.prefs.setComplexValue(kComposeAttachDirPrefName,
- Components.interfaces.nsIFile, parent);
+ Ci.nsIFile, parent);
}
catch (ex) {
dump("error: SetLastAttachDirectory failed: " + ex + "\n");
}
}
function AttachFile()
{
//Get file using nsIFilePicker and convert to URL
try {
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
fp.init(window, sComposeMsgsBundle.getString("chooseFileToAttach"), nsIFilePicker.modeOpenMultiple);
var lastDirectory = GetLocalFilePref(kComposeAttachDirPrefName);
if (lastDirectory)
fp.displayDirectory = lastDirectory;
fp.appendFilters(nsIFilePicker.filterAll);
if (fp.show() == nsIFilePicker.returnOK) {
@@ -2431,27 +2431,27 @@ function AttachFile()
function AttachFiles(attachments)
{
if (!attachments || !attachments.hasMoreElements())
return null;
var firstAttachedFile = null;
while (attachments.hasMoreElements()) {
- var currentFile = attachments.getNext().QueryInterface(Components.interfaces.nsIFile);
+ var currentFile = attachments.getNext().QueryInterface(Ci.nsIFile);
if (!firstAttachedFile) {
firstAttachedFile = currentFile;
}
- var fileHandler = Services.io.getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ var fileHandler = Services.io.getProtocolHandler("file").QueryInterface(Ci.nsIFileProtocolHandler);
var currentAttachment = fileHandler.getURLSpecFromFile(currentFile);
if (!DuplicateFileCheck(currentAttachment)) {
- var attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"].createInstance(Components.interfaces.nsIMsgAttachment);
+ var attachment = Cc["@mozilla.org/messengercompose/attachment;1"].createInstance(Ci.nsIMsgAttachment);
attachment.url = currentAttachment;
attachment.size = currentFile.fileSize;
AddAttachment(attachment);
gContentChanged = true;
}
}
return firstAttachedFile;
}
@@ -2521,18 +2521,18 @@ function MessageGetNumSelectedAttachment
function AttachPage()
{
var params = { action: "5", url: null };
window.openDialog("chrome://communicator/content/openLocation.xul",
"_blank", "chrome,close,titlebar,modal", params);
if (params.url)
{
var attachment =
- Components.classes["@mozilla.org/messengercompose/attachment;1"]
- .createInstance(Components.interfaces.nsIMsgAttachment);
+ Cc["@mozilla.org/messengercompose/attachment;1"]
+ .createInstance(Ci.nsIMsgAttachment);
attachment.url = params.url;
AddAttachment(attachment);
}
}
function DuplicateFileCheck(FileUrl)
{
var bucket = GetMsgAttachmentElement();
@@ -2650,41 +2650,41 @@ function OpenSelectedAttachment()
} else {
// Turn the URL into a nsIURI object then open it.
let uri = Services.io.newURI(attachmentUrl);
if (uri) {
let channel = Services.io.newChannelFromURI2(uri,
null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
if (channel) {
- let uriLoader = Components.classes["@mozilla.org/uriloader;1"].getService(Components.interfaces.nsIURILoader);
+ let uriLoader = Cc["@mozilla.org/uriloader;1"].getService(Ci.nsIURILoader);
uriLoader.openURI(channel, true, new nsAttachmentOpener());
}
}
}
} // if one attachment selected
}
function nsAttachmentOpener()
{
}
nsAttachmentOpener.prototype =
{
QueryInterface: function(iid)
{
- if (iid.equals(Components.interfaces.nsIURIContentListener) ||
- iid.equals(Components.interfaces.nsIInterfaceRequestor) ||
- iid.equals(Components.interfaces.nsISupports)) {
+ if (iid.equals(Ci.nsIURIContentListener) ||
+ iid.equals(Ci.nsIInterfaceRequestor) ||
+ iid.equals(Ci.nsISupports)) {
return this;
}
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
onStartURIOpen: function(uri)
{
return false;
},
doContent: function(contentType, isContentPreferred, request, contentHandler)
@@ -2699,24 +2699,24 @@ nsAttachmentOpener.prototype =
canHandleContent: function(contentType, isContentPreferred, desiredContentType)
{
return false;
},
getInterface: function(iid)
{
- if (iid.equals(Components.interfaces.nsIDOMWindow)) {
+ if (iid.equals(Ci.nsIDOMWindow)) {
return window;
}
- if (iid.equals(Components.interfaces.nsIDocShell)) {
- return window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell);
+ if (iid.equals(Ci.nsIDocShell)) {
+ return window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell);
}
return this.QueryInterface(iid);
},
loadCookie: null,
parentContentListener: null
}
@@ -2961,17 +2961,17 @@ var attachmentBucketObserver = {
if (item.flavour.contentType == "text/x-moz-url" ||
item.flavour.contentType == "text/x-moz-message" ||
item.flavour.contentType == "application/x-moz-file")
{
if (item.flavour.contentType == "application/x-moz-file")
{
let fileHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
size = rawData.fileSize;
rawData = fileHandler.getURLSpecFromFile(rawData);
}
else if (item.flavour.contentType == "text/x-moz-message")
{
size = gMessenger.messageServiceFromURI(rawData)
.messageURIToMsgHdr(rawData).messageSize;
}
@@ -3007,18 +3007,18 @@ var attachmentBucketObserver = {
isValid = false;
}
catch (ex) {
isValid = false;
}
}
if (isValid) {
- attachment = Components.classes["@mozilla.org/messengercompose/attachment;1"]
- .createInstance(Components.interfaces.nsIMsgAttachment);
+ attachment = Cc["@mozilla.org/messengercompose/attachment;1"]
+ .createInstance(Ci.nsIMsgAttachment);
attachment.url = rawData;
attachment.name = prettyName;
if (!isNaN(size))
attachment.size = size;
AddAttachment(attachment);
}
}
}
@@ -3318,17 +3318,17 @@ function removeQueryPart(aURL, aQuery)
return aURL.substr(0, indexQM + 1) + queryParts.join("&");
}
function InitEditor(editor)
{
// Set the eEditorMailMask flag to avoid using content prefs for the spell
// checker, otherwise the dictionary setting in preferences is ignored and
// the dictionary is inconsistent between the subject and message body.
- var eEditorMailMask = Components.interfaces.nsIPlaintextEditor.eEditorMailMask;
+ var eEditorMailMask = Ci.nsIPlaintextEditor.eEditorMailMask;
editor.flags |= eEditorMailMask;
GetMsgSubjectElement().editor.flags |= eEditorMailMask;
// Control insertion of line breaks.
editor.returnInParagraphCreatesNewParagraph =
Services.prefs.getBoolPref("mail.compose.default_to_paragraph") ||
Services.prefs.getBoolPref("editor.CR_creates_new_p");
editor.document.execCommand("defaultparagraphseparator", false,
@@ -3360,45 +3360,45 @@ function InitEditor(editor)
if (!src) {
return;
}
if (!/^file:/i.test(src)) {
// Check if this is a protocol that can fetch parts.
let protocol = src.substr(0, src.indexOf(":")).toLowerCase();
if (!(Services.io.getProtocolHandler(protocol) instanceof
- Components.interfaces.nsIMsgMessageFetchPartService)) {
+ Ci.nsIMsgMessageFetchPartService)) {
// Can't fetch parts, don't try to load.
return;
}
}
if (event.target.classList.contains("loading-internal")) {
// We're already loading this, or tried so unsuccesfully.
return;
}
if (gOriginalMsgURI) {
- let msgSvc = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger)
+ let msgSvc = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger)
.messageServiceFromURI(gOriginalMsgURI);
let originalMsgNeckoURI = {};
msgSvc.GetUrlForUri(gOriginalMsgURI, originalMsgNeckoURI, null);
if (src.startsWith(removeQueryPart(originalMsgNeckoURI.value.spec,
"type=application/x-message-display"))) {
// Reply/Forward/Edit Draft/Edit as New can contain references to
// images in the original message. Load those and make them data: URLs
// now.
event.target.classList.add("loading-internal");
try {
loadBlockedImage(src);
} catch (e) {
// Couldn't load the referenced image.
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
else {
// Appears to reference a random message. Notify and keep blocking.
gComposeNotificationBar.setBlockedContent(src);
}
}
else {
@@ -3407,30 +3407,30 @@ function InitEditor(editor)
gComposeNotificationBar.setBlockedContent(src);
}
}, true);
// Convert mailnews URL back to data: URL.
let background = editor.document.body.background;
if (background && gOriginalMsgURI) {
// Check that background has the same URL as the message itself.
- let msgSvc = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger)
+ let msgSvc = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger)
.messageServiceFromURI(gOriginalMsgURI);
let originalMsgNeckoURI = {};
msgSvc.GetUrlForUri(gOriginalMsgURI, originalMsgNeckoURI, null);
if (background.startsWith(
removeQueryPart(originalMsgNeckoURI.value.spec,
"type=application/x-message-display"))) {
try {
editor.document.body.background = loadBlockedImage(background, true);
} catch (e) {
// Couldn't load the referenced image.
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
}
}
/**
* The event listener for the "spellcheck-changed" event updates
* the document language.
@@ -3480,21 +3480,21 @@ function MailToolboxCustomizeChange(aEve
// Thunderbird compatibility function.
function getPref(aPrefName, aIsComplex)
{
if (aIsComplex)
return GetStringPref(aPrefName);
switch (Services.prefs.getPrefType(aPrefName))
{
- case Components.interfaces.nsIPrefBranch.PREF_BOOL:
+ case Ci.nsIPrefBranch.PREF_BOOL:
return Services.prefs.getBoolPref(aPrefName);
- case Components.interfaces.nsIPrefBranch.PREF_INT:
+ case Ci.nsIPrefBranch.PREF_INT:
return Services.prefs.getIntPref(aPrefName);
- case Components.interfaces.nsIPrefBranch.PREF_STRING:
+ case Ci.nsIPrefBranch.PREF_STRING:
return Services.prefs.getCharPref(aPrefName);
default: // includes nsIPrefBranch.PREF_INVALID
return null;
}
}
/**
* Object to handle message related notifications that are showing in a
@@ -3586,17 +3586,17 @@ function onBlockedContentOptionsShowing(
* @param {Node} aNode - the node holding as value the URLs of the blocked
* resources in the message (space separated).
*/
function onUnblockResource(aURL, aNode) {
try {
loadBlockedImage(aURL);
} catch (e) {
// Couldn't load the referenced image.
- Components.utils.reportError(e);
+ Cu.reportError(e);
} finally {
// Remove it from the list on success and failure.
let urls = aNode.value.split(" ");
for (let i = 0; i < urls.length; i++) {
if (urls[i] == aURL) {
urls.splice(i, 1);
aNode.value = urls.join(" ");
if (urls.length == 0) {
@@ -3627,18 +3627,18 @@ function loadBlockedImage(aURL, aReturnD
filename = (fnMatch && fnMatch[1]) || "";
}
filename = decodeURIComponent(filename);
let uri = Services.io.newURI(aURL);
let contentType;
if (filename) {
try {
- contentType = Components.classes["@mozilla.org/mime;1"]
- .getService(Components.interfaces.nsIMIMEService)
+ contentType = Cc["@mozilla.org/mime;1"]
+ .getService(Ci.nsIMIMEService)
.getTypeFromURI(uri);
} catch (ex) {
contentType = "image/png";
}
if (!contentType.startsWith("image/")) {
// Unsafe to unblock this. It would just be garbage either way.
throw new Error("Won't unblock; URL=" + aURL +
@@ -3650,22 +3650,22 @@ function loadBlockedImage(aURL, aReturnD
contentType = "image/png";
}
let channel =
Services.io.newChannelFromURI2(uri,
null,
Services.scriptSecurityManager.getSystemPrincipal(),
null,
- Components.interfaces.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
- Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+ Ci.nsIContentPolicy.TYPE_OTHER);
let inputStream = channel.open();
- let stream = Components.classes["@mozilla.org/binaryinputstream;1"]
- .createInstance(Components.interfaces.nsIBinaryInputStream);
+ let stream = Cc["@mozilla.org/binaryinputstream;1"]
+ .createInstance(Ci.nsIBinaryInputStream);
stream.setInputStream(inputStream);
let streamData = "";
try {
while (stream.available() > 0) {
streamData += stream.readBytes(stream.available());
}
} catch(e) {
stream.close();
--- a/suite/mailnews/compose/addressingWidgetOverlay.js
+++ b/suite/mailnews/compose/addressingWidgetOverlay.js
@@ -7,18 +7,18 @@ ChromeUtils.import("resource:///modules/
top.MAX_RECIPIENTS = 1; /* for the initial listitem created in the XUL */
var inputElementType = "";
var selectElementType = "";
var selectElementIndexTable = null;
var gNumberOfCols = 0;
-var gDragService = Components.classes["@mozilla.org/widget/dragservice;1"]
- .getService(Components.interfaces.nsIDragService);
+var gDragService = Cc["@mozilla.org/widget/dragservice;1"]
+ .getService(Ci.nsIDragService);
var gMimeHeaderParser = null;
/**
* global variable inherited from MsgComposeCommands.js
*
var gMsgCompose;
*/
@@ -86,17 +86,17 @@ function Recipients2CompFields(msgCompFi
var addrFollow = "";
var to_Sep = "";
var cc_Sep = "";
var bcc_Sep = "";
var reply_Sep = "";
var ng_Sep = "";
var follow_Sep = "";
- gMimeHeaderParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser);
+ gMimeHeaderParser = Cc["@mozilla.org/messenger/headerparser;1"].getService(Ci.nsIMsgHeaderParser);
var recipientType;
var inputField;
var fieldValue;
var recipient;
while ((inputField = awGetInputElement(i)))
{
fieldValue = inputField.value;
@@ -338,17 +338,17 @@ function awTestRowSequence()
Everytime we insert or delete a row, we must be sure we didn't break the ID sequence of
the addressing widget rows. This function will run a quick test to see if the sequence still ok
You need to define the pref mail.debug.test_addresses_sequence to true in order to activate it
*/
var test_sequence;
- if (Services.prefs.getPrefType("mail.debug.test_addresses_sequence") == Components.interfaces.nsIPrefBranch.PREF_BOOL)
+ if (Services.prefs.getPrefType("mail.debug.test_addresses_sequence") == Ci.nsIPrefBranch.PREF_BOOL)
test_sequence = Services.prefs.getBoolPref("mail.debug.test_addresses_sequence");
if (!test_sequence)
return true;
/* debug code to verify the sequence still good */
var listbox = document.getElementById('addressingWidget');
var listitems = listbox.getElementsByTagName('listitem');
@@ -737,17 +737,17 @@ function awRecipientErrorCommand(errItem
// err msg, otherwise fall back to something generic. This message is
// handed to us as an nsISupportsString in the param slot of the
// autocomplete error item, by agreement documented in
// nsILDAPAutoCompFormatter.idl
//
var specificErrString = "";
try {
var specificError = errItem.param.QueryInterface(
- Components.interfaces.nsISupportsString);
+ Ci.nsISupportsString);
specificErrString = specificError.data;
} catch (ex) {
}
if (specificErrString == "") {
specificErrString = "Internal error";
}
Services.prompt.alert(window, generalErrString, specificErrString);
@@ -1101,31 +1101,31 @@ AutomatedAutoCompleteHandler.prototype =
for (sessionIndex in this.searchResults)
{
searchResultsForSession = this.searchResults[sessionIndex];
if (searchResultsForSession && searchResultsForSession.defaultItemIndex > -1)
{
addressToAdd = searchResultsForSession.items
.queryElementAt(searchResultsForSession.defaultItemIndex,
- Components.interfaces.nsIAutoCompleteItem).value;
+ Ci.nsIAutoCompleteItem).value;
break;
}
}
// still no match? loop through looking for the -1 default index
if (!addressToAdd)
{
for (sessionIndex in this.searchResults)
{
searchResultsForSession = this.searchResults[sessionIndex];
if (searchResultsForSession && searchResultsForSession.defaultItemIndex == -1)
{
addressToAdd = searchResultsForSession.items
- .queryElementAt(0, Components.interfaces.nsIAutoCompleteItem).value;
+ .queryElementAt(0, Ci.nsIAutoCompleteItem).value;
break;
}
}
}
// no matches anywhere...just use what we were given
if (!addressToAdd)
addressToAdd = this.namesToComplete[this.indexIntoNames];
@@ -1134,14 +1134,14 @@ AutomatedAutoCompleteHandler.prototype =
awAddRecipient(this.recipientType ? this.recipientType : "addr_to", addressToAdd);
this.indexIntoNames++;
this.autoCompleteNextAddress();
},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIAutoCompleteListener) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIAutoCompleteListener) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
}
--- a/suite/mailnews/compose/prefs/pref-composing_messages.js
+++ b/suite/mailnews/compose/prefs/pref-composing_messages.js
@@ -10,18 +10,18 @@ function Startup() {
function EnableMailComposeAutosaveInterval(aValue) {
let focus = (document.getElementById("autoSave") == document.commandDispatcher.focusedElement);
EnableElementById("autoSaveInterval", aValue, focus);
}
function PopulateFonts() {
var fontsList = document.getElementById("fontSelect");
try {
- var enumerator = Components.classes["@mozilla.org/gfx/fontenumerator;1"]
- .getService(Components.interfaces.nsIFontEnumerator);
+ var enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"]
+ .getService(Ci.nsIFontEnumerator);
var localFontCount = { value: 0 }
var localFonts = enumerator.EnumerateAllFonts(localFontCount);
for (let font of localFonts)
if (font != "serif" && font != "sans-serif" && font != "monospace")
fontsList.appendItem(font, font);
} catch (ex) { }
// Select the item after the list is completely generated.
--- a/suite/mailnews/folderDisplay.js
+++ b/suite/mailnews/folderDisplay.js
@@ -1,15 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gFolderDisplay =
{
- nsMsgFolderFlags: Components.interfaces.nsMsgFolderFlags,
+ nsMsgFolderFlags: Ci.nsMsgFolderFlags,
get selectedCount()
{
return gDBView ? gDBView.numSelected : 0;
},
get selectedMessage()
{
--- a/suite/mailnews/mail-offline.js
+++ b/suite/mailnews/mail-offline.js
@@ -15,19 +15,19 @@ function MailOfflineStateChanged(goingOf
function MsgSettingsOffline()
{
window.parent.MsgAccountManager('am-offline.xul');
}
// Check for unsent messages
function CheckForUnsentMessages()
{
- return Components.classes["@mozilla.org/messengercompose/sendlater;1"]
- .getService(Components.interfaces.nsIMsgSendLater)
- .hasUnsentMessages();
+ return Cc["@mozilla.org/messengercompose/sendlater;1"]
+ .getService(Ci.nsIMsgSendLater)
+ .hasUnsentMessages();
}
// Init strings.
function InitPrompts()
{
if (!gOfflinePromptsBundle)
gOfflinePromptsBundle = document.getElementById("bundle_offlinePrompts");
}
@@ -102,18 +102,18 @@ function InitServices()
if (!gOfflineManager)
GetOfflineMgrService();
}
// Init Offline Manager
function GetOfflineMgrService()
{
if (!gOfflineManager) {
- gOfflineManager = Components.classes["@mozilla.org/messenger/offline-manager;1"]
- .getService(Components.interfaces.nsIMsgOfflineManager);
+ gOfflineManager = Cc["@mozilla.org/messenger/offline-manager;1"]
+ .getService(Ci.nsIMsgOfflineManager);
}
}
// This function must always return false to prevent toggling of offline state because
// we change the offline state ourselves
function MailCheckBeforeOfflineChange()
{
InitServices();
--- a/suite/mailnews/mail3PaneWindowCommands.js
+++ b/suite/mailnews/mail3PaneWindowCommands.js
@@ -334,18 +334,18 @@ var DefaultController =
gDBView.getCommandStatus(nsMsgViewCommandType.junk, enabled, checkStatus);
}
return enabled.value;
case "cmd_markAsShowRemote":
return (GetNumSelectedMessages() > 0 && checkMsgHdrPropertyIsNot("remoteContentPolicy", kAllowRemoteContent));
case "cmd_markAsNotPhish":
return (GetNumSelectedMessages() > 0 && checkMsgHdrPropertyIsNot("notAPhishMessage", kNotAPhishMessage));
case "cmd_displayMsgFilters":
- let mgr = Components.classes["@mozilla.org/messenger/account-manager;1"]
- .getService(Components.interfaces.nsIMsgAccountManager);
+ let mgr = Cc["@mozilla.org/messenger/account-manager;1"]
+ .getService(Ci.nsIMsgAccountManager);
return mgr.accounts.length > 0;
case "cmd_applyFilters":
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.applyFilters, enabled, checkStatus);
return enabled.value;
case "cmd_runJunkControls":
if (gDBView)
gDBView.getCommandStatus(nsMsgViewCommandType.runJunkControls, enabled, checkStatus);
@@ -401,17 +401,17 @@ var DefaultController =
return IsViewNavigationItemEnabled();
case "cmd_viewAllMsgs":
case "cmd_viewUnreadMsgs":
case "cmd_viewIgnoredThreads":
return gDBView;
case "cmd_viewThreadsWithUnread":
case "cmd_viewWatchedThreadsWithUnread":
return gDBView && !(GetSelectedMsgFolders()[0].flags &
- Components.interfaces.nsMsgFolderFlags.Virtual);
+ Ci.nsMsgFolderFlags.Virtual);
case "cmd_stop":
return true;
case "cmd_undo":
case "cmd_redo":
return SetupUndoRedoCommand(command);
case "cmd_renameFolder":
return IsRenameFolderEnabled();
case "cmd_sendUnsentMsgs":
@@ -520,17 +520,17 @@ var DefaultController =
break;
case "cmd_shiftDelete":
case "button_shiftDelete":
MsgDeleteMessage(true);
UpdateDeleteToolbarButton(false);
break;
case "cmd_cancel":
let message = gFolderDisplay.selectedMessage;
- message.folder.QueryInterface(Components.interfaces.nsIMsgNewsFolder)
+ message.folder.QueryInterface(Ci.nsIMsgNewsFolder)
.cancelMessage(message, msgWindow);
break;
case "cmd_killThread":
/* kill thread kills the thread and then does a next unread */
GoNextMessage(nsMsgNavigationType.toggleThreadKilled, true);
break;
case "cmd_killSubthread":
GoNextMessage(nsMsgNavigationType.toggleSubthreadKilled, true);
@@ -819,57 +819,57 @@ function UnloadCommandUpdateHandlers()
var widget = GetFolderTree();
if (widget)
widget.controllers.removeController(FolderPaneController);
}
function IsSendUnsentMsgsEnabled(folderResource)
{
var msgSendLater =
- Components.classes["@mozilla.org/messengercompose/sendlater;1"]
- .getService(Components.interfaces.nsIMsgSendLater);
+ Cc["@mozilla.org/messengercompose/sendlater;1"]
+ .getService(Ci.nsIMsgSendLater);
// If we're currently sending unsent msgs, disable this cmd.
if (msgSendLater.sendingMessages)
return false;
if (folderResource &&
- folderResource instanceof Components.interfaces.nsIMsgFolder) {
+ folderResource instanceof Ci.nsIMsgFolder) {
// If unsentMsgsFolder is non-null, it is the "Outbox" folder.
// We're here because we've done a right click on the "Outbox"
// folder (context menu), so we can use the folder and return true/false
// straight away.
return folderResource.getTotalMessages(false) > 0;
}
// Otherwise, we don't know where we are, so use the current identity and
// find out if we have messages or not via that.
let identity = null;
let folders = GetSelectedMsgFolders();
if (folders.length > 0)
identity = getIdentityForServer(folders[0].server);
if (!identity)
- identity = Components.classes["@mozilla.org/messenger/account-manager;1"]
- .getService(Components.interfaces.nsIMsgAccountManager)
- .defaultAccount.defaultIdentity;
+ identity = Cc["@mozilla.org/messenger/account-manager;1"]
+ .getService(Ci.nsIMsgAccountManager)
+ .defaultAccount.defaultIdentity;
return msgSendLater.hasUnsentMessages(identity);
}
/**
* Determine whether there exists any server for which to show the Subscribe dialog.
*/
function IsSubscribeEnabled()
{
// If there are any IMAP or News servers, we can show the dialog any time and
// it will properly show those.
let servers = accountManager.allServers;
for (let server of fixIterator(servers,
- Components.interfaces.nsIMsgIncomingServer)) {
+ Ci.nsIMsgIncomingServer)) {
if (server.type == "imap" || server.type == "nntp")
return true;
}
// RSS accounts use a separate Subscribe dialog that we can only show when
// such an account is selected.
let preselectedFolder = GetFirstSelectedMsgFolder();
if (preselectedFolder && preselectedFolder.server.type == "rss")
@@ -888,17 +888,17 @@ function IsRenameFolderEnabled()
function IsCanSearchMessagesEnabled()
{
var folderURI = GetSelectedFolderURI();
if (!folderURI)
return false;
var folder = GetMsgFolderFromUri(folderURI, false);
return folder.server.canSearchMessages &&
- !(folder.flags & Components.interfaces.nsMsgFolderFlags.Virtual);
+ !(folder.flags & Ci.nsMsgFolderFlags.Virtual);
}
function IsFolderCharsetEnabled()
{
return IsFolderSelected();
}
function IsPropertiesEnabled(command)
@@ -939,49 +939,49 @@ function MsgDeleteFolder()
var selectedFolders = GetSelectedMsgFolders();
var prompt = Services.prompt;
for (var i = 0; i < selectedFolders.length; i++)
{
var selectedFolder = selectedFolders[i];
let specialFolder = getSpecialFolderString(selectedFolder);
if (specialFolder != "Inbox" && specialFolder != "Trash")
{
- var folder = selectedFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
- if (folder.flags & Components.interfaces.nsMsgFolderFlags.Virtual)
+ var folder = selectedFolder.QueryInterface(Ci.nsIMsgFolder);
+ if (folder.flags & Ci.nsMsgFolderFlags.Virtual)
{
var confirmation = gMessengerBundle.getString("confirmSavedSearchDeleteMessage");
var title = gMessengerBundle.getString("confirmSavedSearchDeleteTitle");
var buttonTitle = gMessengerBundle.getString("confirmSavedSearchDeleteButton");
var buttonFlags = prompt.BUTTON_TITLE_IS_STRING * prompt.BUTTON_POS_0 +
prompt.BUTTON_TITLE_CANCEL * prompt.BUTTON_POS_1;
if (prompt.confirmEx(window, title, confirmation, buttonFlags, buttonTitle,
"", "", "", {}) != 0) /* the yes button is in position 0 */
continue;
if (gCurrentVirtualFolderUri == selectedFolder.URI)
gCurrentVirtualFolderUri = null;
- var array = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var array = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
array.appendElement(folder);
folder.parent.deleteSubFolders(array, msgWindow);
continue;
}
if (isNewsURI(selectedFolder.URI))
{
var unsubscribe = ConfirmUnsubscribe(selectedFolder);
if (unsubscribe)
UnSubscribe(selectedFolder);
}
else if (specialFolder == "Junk" ?
CanRenameDeleteJunkMail(folder.URI) : folder.deletable)
{
// We can delete this folder.
- var array = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var array = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
array.appendElement(selectedFolder);
try
{
selectedFolder.parent.deleteSubFolders(array, msgWindow);
}
// Ignore known errors from canceled warning dialogs.
catch (ex) {
if (ex.result != NS_MSG_ERROR_COPY_FOLDER_ABORTED) {
@@ -1123,17 +1123,17 @@ function CanRenameDeleteJunkMail(aFolder
// Go through junk mail settings for all servers and see if the folder is set/used by anyone.
try
{
var allServers = accountManager.allServers;
for (var i = 0; i < allServers.length; i++)
{
var currentServer =
- allServers.queryElementAt(i, Components.interfaces.nsIMsgIncomingServer);
+ allServers.queryElementAt(i, Ci.nsIMsgIncomingServer);
var settings = currentServer.spamSettings;
// If junk mail control or move junk mail to folder option is disabled then
// allow the folder to be removed/renamed since the folder is not used in this case.
if (!settings.level || !settings.moveOnSpam)
continue;
if (settings.spamFolderURI == aFolderUri)
return false;
}
--- a/suite/mailnews/mailCommands.js
+++ b/suite/mailnews/mailCommands.js
@@ -10,17 +10,17 @@ function GetNewMessages(selectedFolders,
if (!selectedFolders.length)
return;
var msgFolder = selectedFolders[0];
// Whenever we do get new messages, clear the old new messages.
if (msgFolder)
{
- var nsIMsgFolder = Components.interfaces.nsIMsgFolder;
+ var nsIMsgFolder = Ci.nsIMsgFolder;
msgFolder.biffState = nsIMsgFolder.nsMsgBiffState_NoMail;
msgFolder.clearNewMessages();
}
server.getNewMessages(msgFolder, msgWindow, null);
}
/**
* Get the identity that most likely is the best one to use, given the hint.
@@ -36,27 +36,27 @@ function getBestIdentity(identities, opt
// If we have more than one identity and a hint to help us pick one.
if (identityCount > 1 && optionalHint) {
// Normalize case on the optional hint to improve our chances of
// finding a match.
let hints = optionalHint.toLowerCase().split(",");
for (let i = 0 ; i < hints.length; i++) {
for (let identity of fixIterator(identities,
- Components.interfaces.nsIMsgIdentity)) {
+ Ci.nsIMsgIdentity)) {
if (!identity.email)
continue;
if (hints[i].trim() == identity.email.toLowerCase() ||
hints[i].includes("<" + identity.email.toLowerCase() + ">"))
return identity;
}
}
}
// Return only found identity or pick the first one from list if no matches found.
- return identities.queryElementAt(0, Components.interfaces.nsIMsgIdentity);
+ return identities.queryElementAt(0, Ci.nsIMsgIdentity);
}
function getIdentityForServer(server, optionalHint)
{
var identities = accountManager.getIdentitiesForServer(server);
return getBestIdentity(identities, optionalHint);
}
@@ -78,32 +78,32 @@ function GetIdentityForHeader(aMsgHdr, a
deliveredTos.push(currentHeaderData[key].headerValue.toLowerCase().trim());
key = "delivered-to" + index++;
}
// Reverse the array so that the last delivered-to header will show at front.
deliveredTos.reverse();
for (let i = 0; i < deliveredTos.length; i++) {
for (let identity of fixIterator(accountManager.allIdentities,
- Components.interfaces.nsIMsgIdentity)) {
+ Ci.nsIMsgIdentity)) {
if (!identity.email)
continue;
// If the deliver-to header contains the defined identity, that's it.
if (deliveredTos[i] == identity.email.toLowerCase() ||
deliveredTos[i].includes("<" + identity.email.toLowerCase() + ">"))
return identity.email;
}
}
return "";
}
let hintForIdentity = "";
- if (aType == Components.interfaces.nsIMsgCompType.ReplyToList)
+ if (aType == Ci.nsIMsgCompType.ReplyToList)
hintForIdentity = findDeliveredToIdentityEmail();
- else if (aType == Components.interfaces.nsIMsgCompType.Template)
+ else if (aType == Ci.nsIMsgCompType.Template)
hintForIdentity = aMsgHdr.author;
else
hintForIdentity = aMsgHdr.recipients + "," + aMsgHdr.ccList + "," +
findDeliveredToIdentityEmail();
let server = null;
let identity = null;
let folder = aMsgHdr.folder;
@@ -130,27 +130,27 @@ function GetIdentityForHeader(aMsgHdr, a
identity = getBestIdentity(accountManager.allIdentities, hintForIdentity);
}
return identity;
}
function GetNextNMessages(folder)
{
if (folder) {
- var newsFolder = folder.QueryInterface(Components.interfaces.nsIMsgNewsFolder);
+ var newsFolder = folder.QueryInterface(Ci.nsIMsgNewsFolder);
if (newsFolder) {
newsFolder.getNextNMessages(msgWindow);
}
}
}
// type is a nsIMsgCompType and format is a nsIMsgCompFormat
function ComposeMessage(type, format, folder, messageArray)
{
- var msgComposeType = Components.interfaces.nsIMsgCompType;
+ var msgComposeType = Ci.nsIMsgCompType;
var identity = null;
var newsgroup = null;
var hdr;
// dump("ComposeMessage folder=" + folder + "\n");
try
{
if (folder)
@@ -237,27 +237,27 @@ function ComposeMessage(type, format, fo
}
}
function NewMessageToSelectedAddresses(type, format, identity) {
var abSidebarPanel = document.commandDispatcher.focusedWindow;
var abResultsTree = abSidebarPanel.document.getElementById("abResultsTree");
var abResultsBoxObject = abResultsTree.treeBoxObject;
var abView = abResultsBoxObject.view;
- abView = abView.QueryInterface(Components.interfaces.nsIAbView);
+ abView = abView.QueryInterface(Ci.nsIAbView);
var addresses = abView.selectedAddresses;
- var params = Components.classes["@mozilla.org/messengercompose/composeparams;1"].createInstance(Components.interfaces.nsIMsgComposeParams);
+ var params = Cc["@mozilla.org/messengercompose/composeparams;1"].createInstance(Ci.nsIMsgComposeParams);
if (params) {
params.type = type;
params.format = format;
params.identity = identity;
- var composeFields = Components.classes["@mozilla.org/messengercompose/composefields;1"].createInstance(Components.interfaces.nsIMsgCompFields);
+ var composeFields = Cc["@mozilla.org/messengercompose/composefields;1"].createInstance(Ci.nsIMsgCompFields);
if (composeFields) {
let addressList = [];
- const nsISupportsString = Components.interfaces.nsISupportsString;
+ const nsISupportsString = Ci.nsISupportsString;
for (let i = 0; i < addresses.length; i++) {
addressList.push(addresses.queryElementAt(i, nsISupportsString).data);
}
composeFields.to = addressList.join(",");
params.composeFields = composeFields;
msgComposeService.OpenComposeWindowWithParams(null, params);
}
}
@@ -272,17 +272,17 @@ function NewFolder(name, folder)
}
function UnSubscribe(folder)
{
// Unsubscribe the current folder from the newsserver, this assumes any confirmation has already
// been made by the user SPL
var server = folder.server;
- var subscribableServer = server.QueryInterface(Components.interfaces.nsISubscribableServer);
+ var subscribableServer = server.QueryInterface(Ci.nsISubscribableServer);
subscribableServer.unsubscribe(folder.name);
subscribableServer.commitSubscribeChanges();
}
function Subscribe(preselectedMsgFolder)
{
window.openDialog("chrome://messenger/content/subscribe.xul",
"subscribe", "chrome,modal,titlebar,resizable=yes",
@@ -291,17 +291,17 @@ function Subscribe(preselectedMsgFolder)
}
function SubscribeOKCallback(changeTable)
{
for (var serverURI in changeTable) {
var folder = GetMsgFolderFromUri(serverURI, true);
var server = folder.server;
var subscribableServer =
- server.QueryInterface(Components.interfaces.nsISubscribableServer);
+ server.QueryInterface(Ci.nsISubscribableServer);
for (var name in changeTable[serverURI]) {
if (changeTable[serverURI][name] == true) {
try {
subscribableServer.subscribe(name);
}
catch (ex) {
dump("failed to subscribe to " + name + ": " + ex + "\n");
@@ -379,21 +379,21 @@ function SaveAsTemplate(aUris)
var num = aUris.length;
if (!num)
return;
for (let i = 0; i < num; i++)
{
let uri = aUris[i];
var hdr = messenger.msgHdrFromURI(uri);
- var identity = GetIdentityForHeader(hdr, Components.interfaces.nsIMsgCompType.Template);
+ var identity = GetIdentityForHeader(hdr, Ci.nsIMsgCompType.Template);
var templates = MailUtils.getFolderForURI(identity.stationeryFolder, false);
if (!templates.parent)
{
- templates.setFlag(Components.interfaces.nsMsgFolderFlags.Templates);
+ templates.setFlag(Ci.nsMsgFolderFlags.Templates);
let isAsync = templates.server.protocolInfo.foldersCreatedAsync;
templates.createStorageIfMissing(new saveAsUrlListener(uri, identity));
if (isAsync)
continue;
}
messenger.saveAs(uri, false, identity, null);
}
}
@@ -418,19 +418,19 @@ function ViewPageSource(messages)
dump("MsgViewPageSource(): No messages selected.\n");
return false;
}
var browser = getBrowser();
try {
// First, get the mail session
- const nsIMsgMailSession = Components.interfaces.nsIMsgMailSession;
- var mailSession = Components.classes["@mozilla.org/messenger/services/session;1"]
- .getService(nsIMsgMailSession);
+ const nsIMsgMailSession = Ci.nsIMsgMailSession;
+ var mailSession = Cc["@mozilla.org/messenger/services/session;1"]
+ .getService(nsIMsgMailSession);
for (var i = 0; i < numMessages; i++)
{
// Now, we need to get a URL from a URI
var url = mailSession.ConvertMsgURIToMsgURL(messages[i], msgWindow);
// Strip out the message-display parameter to ensure that attached
// emails display the message source, not the processed HTML.
@@ -493,18 +493,18 @@ function deleteAllInFolder(commandName)
if (!confirmToProceed(commandName))
return;
// Delete sub-folders.
var iter = folder.subFolders;
while (iter.hasMoreElements())
folder.propagateDelete(iter.getNext(), true, msgWindow);
- var children = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var children = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
// Delete messages.
iter = folder.messages;
while (iter.hasMoreElements()) {
children.appendElement(iter.getNext());
}
folder.deleteMessages(children, msgWindow, true, false, null, false);
children.clear();
--- a/suite/mailnews/mailContextMenus.js
+++ b/suite/mailnews/mailContextMenus.js
@@ -219,17 +219,17 @@ function FillFolderPaneContextMenu()
let serverType = folder.server.type;
let specialFolder = getSpecialFolderString(folder);
var canSubscribeToFolder = (serverType == "nntp") ||
(serverType == "imap") ||
(serverType == "rss");
var isNewsgroup = !isServer && serverType == 'nntp';
var isMailFolder = !isServer && serverType != 'nntp';
var isVirtualFolder = (specialFolder == "Virtual");
- const kTrashFlag = Components.interfaces.nsMsgFolderFlags.Trash;
+ const kTrashFlag = Ci.nsMsgFolderFlags.Trash;
let isChildOfTrash = folder.isSpecialFolder(kTrashFlag, true);
var canGetMessages =
(isServer && serverType != "none") ||
isNewsgroup ||
((serverType == "rss") && !isChildOfTrash && !isVirtualFolder);
if (!isServer)
{
@@ -453,31 +453,31 @@ function EditContact(aEmailAddressNode)
function SendMailToNode(emailAddressNode, aEvent)
{
if (emailAddressNode)
SendMailTo(emailAddressNode.getAttribute("fullAddress"), aEvent);
}
function SendMailTo(fullAddress, aEvent)
{
- var fields = Components.classes["@mozilla.org/messengercompose/composefields;1"]
- .createInstance(Components.interfaces.nsIMsgCompFields);
- var params = Components.classes["@mozilla.org/messengercompose/composeparams;1"]
- .createInstance(Components.interfaces.nsIMsgComposeParams);
+ var fields = Cc["@mozilla.org/messengercompose/composefields;1"]
+ .createInstance(Ci.nsIMsgCompFields);
+ var params = Cc["@mozilla.org/messengercompose/composeparams;1"]
+ .createInstance(Ci.nsIMsgComposeParams);
var headerParser = MailServices.headerParser;
var addresses = headerParser.makeFromDisplayAddress(fullAddress);
fields.to = headerParser.makeMimeHeader(addresses, 1);
- params.type = Components.interfaces.nsIMsgCompType.New;
+ params.type = Ci.nsIMsgCompType.New;
// If aEvent is passed, check if Shift key was pressed for composition in
// non-default format (HTML vs. plaintext).
params.format = (aEvent && aEvent.shiftKey) ?
- Components.interfaces.nsIMsgCompFormat.OppositeOfDefault :
- Components.interfaces.nsIMsgCompFormat.Default;
+ Ci.nsIMsgCompFormat.OppositeOfDefault :
+ Ci.nsIMsgCompFormat.Default;
params.identity = accountManager.getFirstIdentityForServer(GetLoadedMsgFolder().server);
params.composeFields = fields;
MailServices.compose.OpenComposeWindowWithParams(null, params);
}
// CopyEmailAddress takes the email address title button, extracts
// the email address we stored in there and copies it to the clipboard
@@ -538,26 +538,26 @@ function OpenMessageForMessageId(message
window.setCursor("wait");
// first search in current folder for message id
var messageHeader = CheckForMessageIdInFolder(gDBView.msgFolder, messageId);
// if message id not found in current folder search in all folders
if (!messageHeader)
{
- var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"]
- .getService(Components.interfaces.nsIMsgAccountManager);
+ var accountManager = Cc["@mozilla.org/messenger/account-manager;1"]
+ .getService(Ci.nsIMsgAccountManager);
var allServers = accountManager.allServers;
messageHeader = SearchForMessageIdInSubFolder(startServer.rootFolder, messageId);
for (var i = 0; i < allServers.length && !messageHeader; i++)
{
var currentServer =
- allServers.queryElementAt(i, Components.interfaces.nsIMsgIncomingServer);
+ allServers.queryElementAt(i, Ci.nsIMsgIncomingServer);
if (currentServer && startServer != currentServer &&
currentServer.canSearchMessages && !currentServer.isDeferredTo)
{
messageHeader = SearchForMessageIdInSubFolder(currentServer.rootFolder, messageId);
}
}
}
window.setCursor("auto");
@@ -636,17 +636,17 @@ function SearchForMessageIdInSubFolder(f
if (!folder.isServer)
messageHeader = CheckForMessageIdInFolder(folder, messageId);
// search subfolders recursively
while (subFolders.hasMoreElements() && !messageHeader)
{
// search in current folder
var currentFolder =
- subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
+ subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
messageHeader = CheckForMessageIdInFolder(currentFolder, messageId);
// search in its subfolder
if (!messageHeader && currentFolder.hasSubFolders)
messageHeader = SearchForMessageIdInSubFolder(currentFolder, messageId);
}
@@ -666,21 +666,21 @@ function CheckForMessageIdInFolder(folde
}
catch (ex)
{
dump("Failed to find message-id in folder!");
}
if (!gMailSession)
{
- gMailSession = Components.classes["@mozilla.org/messenger/services/session;1"]
- .getService(Components.interfaces.nsIMsgMailSession);
+ gMailSession = Cc["@mozilla.org/messenger/services/session;1"]
+ .getService(Ci.nsIMsgMailSession);
}
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
if (!gMailSession.IsFolderOpenInWindow(folder) &&
!(folder.flags & (nsMsgFolderFlags.Trash | nsMsgFolderFlags.Inbox)))
{
folder.msgDatabase = null;
}
return messageHeader;
}
@@ -703,25 +703,25 @@ function CreateFilterFromMail(emailAddre
function CopyMessageUrl()
{
try
{
var hdr = gDBView.hdrForFirstSelectedMessage;
var server = hdr.folder.server;
// TODO let backend construct URL and return as attribute
- var url = (server.socketType == Components.interfaces.nsMsgSocketType.SSL) ?
+ var url = (server.socketType == Ci.nsMsgSocketType.SSL) ?
"snews://" : "news://";
url += server.hostName + ":" + server.port + "/" + hdr.messageId;
CopyString(url);
}
catch (ex)
{
dump("ex="+ex+"\n");
}
}
function CopyString(aString)
{
- Components.classes["@mozilla.org/widget/clipboardhelper;1"]
- .getService(Components.interfaces.nsIClipboardHelper)
- .copyString(aString);
+ Cc["@mozilla.org/widget/clipboardhelper;1"]
+ .getService(Ci.nsIClipboardHelper)
+ .copyString(aString);
}
--- a/suite/mailnews/mailEditorOverlay.xul
+++ b/suite/mailnews/mailEditorOverlay.xul
@@ -12,33 +12,33 @@
<overlay id="mailEditorOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript">
<![CDATA[
function openComposeWindow(pageUrl, pageTitle)
{
- var params = Components.classes["@mozilla.org/messengercompose/composeparams;1"].createInstance(Components.interfaces.nsIMsgComposeParams);
+ var params = Cc["@mozilla.org/messengercompose/composeparams;1"].createInstance(Ci.nsIMsgComposeParams);
if (params)
{
- params.composeFields = Components.classes['@mozilla.org/messengercompose/composefields;1'].createInstance(Components.interfaces.nsIMsgCompFields);
+ params.composeFields = Cc['@mozilla.org/messengercompose/composefields;1'].createInstance(Ci.nsIMsgCompFields);
if (params.composeFields)
{
params.composeFields.body = pageUrl;
params.composeFields.subject = pageTitle;
- var attachmentData = Components.classes["@mozilla.org/messengercompose/attachment;1"].createInstance(Components.interfaces.nsIMsgAttachment);
+ var attachmentData = Cc["@mozilla.org/messengercompose/attachment;1"].createInstance(Ci.nsIMsgAttachment);
if (attachmentData)
{
attachmentData.url = pageUrl;
params.composeFields.addAttachment(attachmentData);
}
params.bodyIsLink = true;
- var composeService = Components.classes["@mozilla.org/messengercompose;1"].getService(Components.interfaces.nsIMsgComposeService);
+ var composeService = Cc["@mozilla.org/messengercompose;1"].getService(Ci.nsIMsgComposeService);
if (composeService)
composeService.OpenComposeWindowWithParams(null, params);
}
}
}
]]>
</script>
--- a/suite/mailnews/mailOverlay.js
+++ b/suite/mailnews/mailOverlay.js
@@ -15,15 +15,15 @@ function goOpenNewMessage()
// identity, based on the selected message or folder
// if not, bring up the compose window to the default identity
if ("MsgNewMessage" in window)
{
MsgNewMessage(null);
return;
}
- Components.classes["@mozilla.org/messengercompose;1"]
- .getService(Components.interfaces.nsIMsgComposeService)
- .OpenComposeWindow(null, null, null,
- Components.interfaces.nsIMsgCompType.New,
- Components.interfaces.nsIMsgCompFormat.Default,
+ Cc["@mozilla.org/messengercompose;1"]
+ .getService(Ci.nsIMsgComposeService)
+ .OpenComposeWindow(null, null, null,
+ Ci.nsIMsgCompType.New,
+ Ci.nsIMsgCompFormat.Default,
null, null);
}
--- a/suite/mailnews/mailTasksOverlay.js
+++ b/suite/mailnews/mailTasksOverlay.js
@@ -36,45 +36,45 @@ function toImport()
"chrome, modal, titlebar, centerscreen");
}
function CoalesceGetMsgsForPop3ServersByDestFolder(aCurrentServer,
aPOP3DownloadServersArray,
aLocalFoldersToDownloadTo)
{
// coalesce the servers that download into the same folder...
- var inbox = aCurrentServer.rootMsgFolder.getFolderWithFlags(Components.interfaces.nsMsgFolderFlags.Inbox);
+ var inbox = aCurrentServer.rootMsgFolder.getFolderWithFlags(Ci.nsMsgFolderFlags.Inbox);
var index = aLocalFoldersToDownloadTo.indexOf(inbox);
if (index == -1)
{
- inbox.biffState = Components.interfaces.nsIMsgFolder.nsMsgBiffState_NoMail;
+ inbox.biffState = Ci.nsIMsgFolder.nsMsgBiffState_NoMail;
inbox.clearNewMessages();
aLocalFoldersToDownloadTo.push(inbox);
index = aPOP3DownloadServersArray.length;
aPOP3DownloadServersArray.push([]);
}
aPOP3DownloadServersArray[index].push(aCurrentServer);
}
function MailTasksGetMessagesForAllServers(aBiff, aMsgWindow, aDefaultServer)
{
// now log into any server
try
{
- var allServers = Components.classes["@mozilla.org/messenger/account-manager;1"]
- .getService(Components.interfaces.nsIMsgAccountManager)
- .allServers;
+ var allServers = Cc["@mozilla.org/messenger/account-manager;1"]
+ .getService(Ci.nsIMsgAccountManager)
+ .allServers;
// array of array of servers for a particular folder
var pop3DownloadServersArray = [];
// parallel array of folders to download to...
var localFoldersToDownloadTo = [];
var pop3Server = null;
for (let i = 0; i < allServers.length; ++i)
{
- let currentServer = allServers.queryElementAt(i, Components.interfaces.nsIMsgIncomingServer);
+ let currentServer = allServers.queryElementAt(i, Ci.nsIMsgIncomingServer);
if (currentServer)
{
if (aBiff)
{
if (currentServer.protocolInfo.canLoginAtStartUp &&
currentServer.loginAtStartUp)
{
if (aDefaultServer &&
@@ -115,45 +115,45 @@ function MailTasksGetMessagesForAllServe
// get new messages on the server for IMAP or RSS
GetMessagesForInboxOnServer(currentServer);
}
}
}
}
}
- if (pop3Server instanceof Components.interfaces.nsIPop3IncomingServer)
+ if (pop3Server instanceof Ci.nsIPop3IncomingServer)
{
for (let i = 0; i < pop3DownloadServersArray.length; ++i)
{
// any ol' pop3Server will do -
// the serversArray specifies which servers to download from
pop3Server.downloadMailFromServers(pop3DownloadServersArray[i],
pop3DownloadServersArray[i].length,
aMsgWindow,
localFoldersToDownloadTo[i],
null);
}
}
}
catch (e)
{
- Components.utils.reportError(e);
+ Cu.reportError(e);
}
}
const biffObserver =
{
observe: function observe(subject, topic, state)
{
// sanity check
if (topic == BIFF_TOPIC)
{
- var biffManager = Components.classes["@mozilla.org/messenger/statusBarBiffManager;1"]
- .getService(Components.interfaces.nsIStatusBarBiffManager);
+ var biffManager = Cc["@mozilla.org/messenger/statusBarBiffManager;1"]
+ .getService(Ci.nsIStatusBarBiffManager);
document.getElementById("mini-mail")
.setAttribute("BiffState",
[BIFF_STATE_MESSAGES,
BIFF_STATE_NOMESSAGES,
BIFF_STATE_UNKNOWN][biffManager.biffState]);
}
}
};
@@ -183,20 +183,20 @@ function MailTasksOnLoad(aEvent)
// The MailNews main window will perform biff later in its onload handler,
// so we don't need to do this here.
if (Services.wm.getMostRecentWindow("mail:3pane"))
return;
// If we already have a defined biff-state set on the mini-mail icon,
// we know that biff is already running.
- const kBiffState = Components.classes["@mozilla.org/messenger/statusBarBiffManager;1"]
- .getService(Components.interfaces.nsIStatusBarBiffManager)
- .biffState;
- if (kBiffState != Components.interfaces.nsIMsgFolder.nsMsgBiffState_Unknown)
+ const kBiffState = Cc["@mozilla.org/messenger/statusBarBiffManager;1"]
+ .getService(Ci.nsIStatusBarBiffManager)
+ .biffState;
+ if (kBiffState != Ci.nsIMsgFolder.nsMsgBiffState_Unknown)
return;
// still no excuse to refuse to use this ruse
MailTasksGetMessagesForAllServers(true, null, null);
}
function MailTasksOnUnload(aEvent)
{
@@ -224,20 +224,20 @@ nsMsgBadCertHandler.prototype = {
// nsIInterfaceRequestor
getInterface: function(iid) {
return this.QueryInterface(iid);
},
// nsISupports
QueryInterface: function(iid) {
- if (!iid.equals(Components.interfaces.nsIBadCertListener2) &&
- !iid.equals(Components.interfaces.nsIInterfaceRequestor) &&
- !iid.equals(Components.interfaces.nsISupports))
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ if (!iid.equals(Ci.nsIBadCertListener2) &&
+ !iid.equals(Ci.nsIInterfaceRequestor) &&
+ !iid.equals(Ci.nsISupports))
+ throw Cr.NS_ERROR_NO_INTERFACE;
return this;
}
};
function InformUserOfCertError(status, targetSite)
{
var params = { exceptionAdded : false,
sslStatus : status,
--- a/suite/mailnews/mailViewList.js
+++ b/suite/mailnews/mailViewList.js
@@ -57,18 +57,18 @@ var gMailViewListController =
{
for (let command of ["cmd_new", "cmd_edit", "cmd_delete"])
goUpdateCommand(command);
}
};
function MailViewListOnLoad()
{
- gMailListView = Components.classes["@mozilla.org/messenger/mailviewlist;1"]
- .getService(Components.interfaces.nsIMsgMailViewList);
+ gMailListView = Cc["@mozilla.org/messenger/mailviewlist;1"]
+ .getService(Ci.nsIMsgMailViewList);
gListBox = document.getElementById('mailViewList');
window.controllers.insertControllerAt(0, gMailViewListController);
// Construct list view based on current mail view list data
RefreshListView(null);
gEditButton = document.getElementById('editButton');
gDeleteButton = document.getElementById('deleteButton');
@@ -100,22 +100,22 @@ function OnNewMailView()
window.openDialog('chrome://messenger/content/mailViewSetup.xul',
'',
'centerscreen,resizable,modal,titlebar,chrome',
{onOkCallback: RefreshListView});
}
function OnDeleteMailView()
{
- var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService);
+ var strBundleService = Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService);
var bundle = strBundleService.createBundle("chrome://messenger/locale/messenger.properties");
- var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
+ var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
+ .getService(Ci.nsIPromptService);
if (!promptService.confirm(window, bundle.GetStringFromName("confirmViewDeleteTitle"),
bundle.GetStringFromName("confirmViewDeleteMessage")))
return;
// get the selected index
var selectedIndex = gListBox.selectedIndex;
if (selectedIndex >= 0)
{
--- a/suite/mailnews/mailViewSetup.js
+++ b/suite/mailnews/mailViewSetup.js
@@ -1,14 +1,14 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
+var nsMsgSearchScope = Ci.nsMsgSearchScope;
var gMailView = null;
var dialog;
function mailViewOnLoad()
{
initializeSearchWidgets();
initializeMailViewOverrides();
@@ -42,17 +42,17 @@ function mailViewOnLoad()
function mailViewOnUnLoad()
{
}
function onOK()
{
- var mailViewList = Components.classes["@mozilla.org/messenger/mailviewlist;1"].getService(Components.interfaces.nsIMsgMailViewList);
+ var mailViewList = Cc["@mozilla.org/messenger/mailviewlist;1"].getService(Ci.nsIMsgMailViewList);
// reflect the search widgets back into the search session
var newMailView = null;
if (gMailView)
{
saveSearchTerms(gMailView.searchTerms, gMailView);
// if the name of the view has been changed...
if (gMailView.prettyName != dialog.nameField.value)
--- a/suite/mailnews/mailWidgets.xml
+++ b/suite/mailnews/mailWidgets.xml
@@ -719,18 +719,18 @@
// aTags contains a list of actual tag names (not the keys), delimited by spaces
// each tag name is encoded.
// remove any existing tag items we've appended to the list
var headerValueNode = document.getAnonymousElementByAttribute(this, 'anonid', 'headerValue');
for (var i = headerValueNode.childNodes.length - 1; i >= 0; --i)
headerValueNode.childNodes[i].remove();
- var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
- .getService(Components.interfaces.nsIMsgTagService);
+ var tagService = Cc["@mozilla.org/messenger/tagservice;1"]
+ .getService(Ci.nsIMsgTagService);
// tokenize the keywords based on ' '
var tagsArray = aTags.split(' ');
for (var index = 0; index < tagsArray.length; index++)
{
// for each tag, create a label, give it the font color that corresponds to the
// color of the tag and append it.
var tagName;
@@ -762,17 +762,17 @@
</xul:menulist>
</content>
<implementation>
<field name="internalScope">null</field>
<field name="internalValue">-1</field>
<field readonly="true" name="validityManager">
<![CDATA[
- Components.classes['@mozilla.org/mail/search/validityManager;1'].getService(Components.interfaces.nsIMsgSearchValidityManager);
+ Cc['@mozilla.org/mail/search/validityManager;1'].getService(Ci.nsIMsgSearchValidityManager);
]]>
</field>
<field name="filterService">
Components.classes["@mozilla.org/messenger/services/filters;1"]
.getService(Components.interfaces.nsIMsgFilterService)
</field>
<property name="searchScope" onget="return this.internalScope;">
<!-- scope ID - retrieve the table -->
@@ -911,17 +911,17 @@
while (popup.hasChildNodes())
popup.lastChild.remove();
var newSelection;
var customizePos=-1;
for (var i = 0; i < menuItemIds.length; ++i)
{
// create the menuitem
- if (Components.interfaces.nsMsgSearchAttrib.OtherHeader == menuItemIds[i].toString())
+ if (Ci.nsMsgSearchAttrib.OtherHeader == menuItemIds[i].toString())
customizePos = i;
else
{
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", menuItemStrings[i]);
menuitem.setAttribute("value", menuItemIds[i]);
popup.appendChild(menuitem);
// try to restore the selection
@@ -962,38 +962,38 @@
</binding>
<!-- searchattribute - Subject, Sender, To, CC, etc. -->
<binding id="searchattribute" name="searchAttribute"
extends="chrome://messenger/content/mailWidgets.xml#search-menulist-abstract">
<implementation>
<field name="stringBundle">
<![CDATA[
- Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle("chrome://messenger/locale/search-attributes.properties")
+ Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle("chrome://messenger/locale/search-attributes.properties")
]]>
</field>
<property name="valueLabel" readonly="true">
<getter>
<![CDATA[
if (isNaN(this.value)) // is this a custom term?
{
let customTerm = this.filterService.getCustomTerm(this.value);
if (customTerm)
return customTerm.name;
else
{
- let consoleService = Components.classes["@mozilla.org/consoleservice;1"]
- .getService(Components.interfaces.nsIConsoleService);
- let scriptError = Components.classes["@mozilla.org/scripterror;1"]
- .createInstance(Components.interfaces.nsIScriptError);
+ let consoleService = Cc["@mozilla.org/consoleservice;1"]
+ .getService(Ci.nsIConsoleService);
+ let scriptError = Cc["@mozilla.org/scripterror;1"]
+ .createInstance(Ci.nsIScriptError);
scriptError.init("Missing custom search term " + this.value,
null, null, 0, 0,
- Components.interfaces.nsIScriptError.errorFlag,
+ Ci.nsIScriptError.errorFlag,
"component javascript");
consoleService.logMessage(scriptError);
return this.stringBundle.GetStringFromName("MissingCustomTerm");
}
}
return this.stringBundle.GetStringFromName(
this.validityManager.getAttributeProperty(parseInt(this.value)));
]]>
@@ -1005,17 +1005,17 @@
var length = new Object;
let result = this.validityTable.getAvailableAttributes(length);
// add any available custom search terms
let customEnum = this.filterService.getCustomTerms();
while (customEnum && customEnum.hasMoreElements())
{
let customTerm =
customEnum.getNext()
- .QueryInterface(Components.interfaces.nsIMsgSearchCustomTerm);
+ .QueryInterface(Ci.nsIMsgSearchCustomTerm);
// for custom terms, the array element is a string with the custom id
// instead of the integer attribute
if (customTerm.getAvailable(this.searchScope, null))
result.push(customTerm.id);
}
return result;
]]>
</getter>
@@ -1023,19 +1023,19 @@
<property name="valueStrings" readonly="true">
<getter>
<![CDATA[
let strings = new Array;
let ids = this.valueIds;
let hdrsArray = null;
try
{
- let hdrs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch)
- .getCharPref("mailnews.customHeaders");
+ let hdrs = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch)
+ .getCharPref("mailnews.customHeaders");
hdrs = hdrs.replace(/\s+/g, ""); //remove white spaces before splitting
hdrsArray = hdrs.match(/[^:]+/g);
}
catch(ex)
{
}
let j = 0;
@@ -1044,17 +1044,17 @@
if (isNaN(ids[i])) // Is this a custom search term?
{
let customTerm = this.filterService.getCustomTerm(ids[i]);
if (customTerm)
strings[i] = customTerm.name;
else
strings[i] = "";
}
- else if(ids[i] > Components.interfaces.nsMsgSearchAttrib.OtherHeader && hdrsArray)
+ else if(ids[i] > Ci.nsMsgSearchAttrib.OtherHeader && hdrsArray)
strings[i] = hdrsArray[j++];
else
strings[i] = this.stringBundle.GetStringFromName(
this.validityManager.getAttributeProperty(ids[i]));
}
return strings;
]]>
</getter>
@@ -1069,19 +1069,19 @@
<!-- searchoperator - Contains, Is Less than, etc -->
<binding id="searchoperator" name="searchOperator"
extends="chrome://messenger/content/mailWidgets.xml#search-menulist-abstract">
<implementation>
<field name="searchAttribute">Components.interfaces.nsMsgSearchAttrib.Default</field>
<field name="stringBundle">
<![CDATA[
- Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle("chrome://messenger/locale/search-operators.properties")
+ Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle("chrome://messenger/locale/search-operators.properties")
]]>
</field>
<property name="valueLabel" readonly="true">
<getter>
<![CDATA[
return this.stringBundle.GetStringFromName(this.value);
]]>
</getter>
@@ -1091,17 +1091,17 @@
<![CDATA[
var length = new Object;
let isCustom = isNaN(this.searchAttribute);
if (isCustom)
{
let customTerm = this.filterService.getCustomTerm(this.searchAttribute);
if (customTerm)
return customTerm.getAvailableOperators(this.searchScope, length);
- return [Components.interfaces.nsMsgSearchOp.Contains];
+ return [Ci.nsMsgSearchOp.Contains];
}
return this.validityTable.getAvailableOperators(this.searchAttribute,length);
]]>
</getter>
</property>
<property name="valueStrings" readonly="true">
<getter>
<![CDATA[
@@ -1111,28 +1111,28 @@
strings[i] = this.stringBundle.GetStringFromID(ids[i]);
return strings;
]]>
</getter>
</property>
<property name="parentValue">
<setter>
<![CDATA[
- if (this.searchAttribute == val && val != Components.interfaces.nsMsgSearchAttrib.OtherHeader) return val;
+ if (this.searchAttribute == val && val != Ci.nsMsgSearchAttrib.OtherHeader) return val;
this.searchAttribute = val;
this.refreshList(true); // don't restore the selection, since searchvalue nulls it
- if (val == Components.interfaces.nsMsgSearchAttrib.OtherHeader)
+ if (val == Ci.nsMsgSearchAttrib.OtherHeader)
{
window.openDialog('chrome://messenger/content/CustomHeaders.xul', "", 'modal,centerscreen,resizable,titlebar,chrome', null);
setTimeout(UpdateAfterCustomHeaderChange, 0); // XXX bug 212625
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.AgeInDays)
+ else if (val == Ci.nsMsgSearchAttrib.AgeInDays)
{
// Bug 187741 We want "Age in Days" to default to "is less than".
- this.value = Components.interfaces.nsMsgSearchOp.IsLessThan;
+ this.value = Ci.nsMsgSearchOp.IsLessThan;
}
return val;
]]>
</setter>
<getter>
<![CDATA[
return this.searchAttribute;
]]>
@@ -1212,67 +1212,67 @@
</field>
<property name="opParentValue" onget="return this.internalOperator;">
<setter>
<![CDATA[
// noop if we're not changing it
if (this.internalOperator == val) return val;
// Keywords has the null field IsEmpty
- if (this.searchAttribute == Components.interfaces.nsMsgSearchAttrib.Keywords) {
- if (val == Components.interfaces.nsMsgSearchOp.IsEmpty ||
- val == Components.interfaces.nsMsgSearchOp.IsntEmpty)
+ if (this.searchAttribute == Ci.nsMsgSearchAttrib.Keywords) {
+ if (val == Ci.nsMsgSearchOp.IsEmpty ||
+ val == Ci.nsMsgSearchOp.IsntEmpty)
this.setAttribute("selectedIndex", "-1");
else
this.setAttribute("selectedIndex", "5");
}
// JunkStatus has the null field IsEmpty
- if (this.searchAttribute == Components.interfaces.nsMsgSearchAttrib.JunkStatus) {
- if (val == Components.interfaces.nsMsgSearchOp.IsEmpty ||
- val == Components.interfaces.nsMsgSearchOp.IsntEmpty)
+ if (this.searchAttribute == Ci.nsMsgSearchAttrib.JunkStatus) {
+ if (val == Ci.nsMsgSearchOp.IsEmpty ||
+ val == Ci.nsMsgSearchOp.IsntEmpty)
this.setAttribute("selectedIndex", "-1");
else
this.setAttribute("selectedIndex", "6");
}
// if it's not sender, to, cc, alladdresses, or toorcc, we don't care
- if (this.searchAttribute != Components.interfaces.nsMsgSearchAttrib.Sender &&
- this.searchAttribute != Components.interfaces.nsMsgSearchAttrib.To &&
- this.searchAttribute != Components.interfaces.nsMsgSearchAttrib.ToOrCC &&
- this.searchAttribute != Components.interfaces.nsMsgSearchAttrib.AllAddresses &&
- this.searchAttribute != Components.interfaces.nsMsgSearchAttrib.CC ) {
+ if (this.searchAttribute != Ci.nsMsgSearchAttrib.Sender &&
+ this.searchAttribute != Ci.nsMsgSearchAttrib.To &&
+ this.searchAttribute != Ci.nsMsgSearchAttrib.ToOrCC &&
+ this.searchAttribute != Ci.nsMsgSearchAttrib.AllAddresses &&
+ this.searchAttribute != Ci.nsMsgSearchAttrib.CC ) {
this.internalOperator = val;
return val;
}
var children = document.getAnonymousNodes(this);
- if (val == Components.interfaces.nsMsgSearchOp.IsntInAB ||
- val == Components.interfaces.nsMsgSearchOp.IsInAB) {
+ if (val == Ci.nsMsgSearchOp.IsntInAB ||
+ val == Ci.nsMsgSearchOp.IsInAB) {
// if the old internalOperator was
// IsntInAB or IsInAB, and the new internalOperator is
// IsntInAB or IsInAB, noop because the search value
// was an ab type, and it still is.
// otherwise, switch to the ab picker and select the PAB
- if (this.internalOperator != Components.interfaces.nsMsgSearchOp.IsntInAB &&
- this.internalOperator != Components.interfaces.nsMsgSearchOp.IsInAB) {
+ if (this.internalOperator != Ci.nsMsgSearchOp.IsntInAB &&
+ this.internalOperator != Ci.nsMsgSearchOp.IsInAB) {
var abs = children[4].getElementsByAttribute("value", "moz-abmdbdirectory://abook.mab");
if (abs.item(0))
children[4].selectedItem = abs[0];
this.setAttribute("selectedIndex", "4");
}
}
else {
// if the old internalOperator wasn't
// IsntInAB or IsInAB, and the new internalOperator isn't
// IsntInAB or IsInAB, noop because the search value
// wasn't an ab type, and it still isn't.
// otherwise, switch to the textbox and clear it
- if (this.internalOperator == Components.interfaces.nsMsgSearchOp.IsntInAB ||
- this.internalOperator == Components.interfaces.nsMsgSearchOp.IsInAB) {
+ if (this.internalOperator == Ci.nsMsgSearchOp.IsntInAB ||
+ this.internalOperator == Ci.nsMsgSearchOp.IsInAB) {
children[0].value = "";
this.setAttribute("selectedIndex", "0");
}
}
this.internalOperator = val;
return val;
]]>
@@ -1298,56 +1298,56 @@
this.setAttribute("selectedIndex", "9");
let customHbox = document.getAnonymousNodes(this)[9];
if (this.internalValue)
customHbox.setAttribute("value", this.internalValue.str);
// the searchAttribute attribute is intended as a selector in
// CSS for custom search terms to bind a custom value
customHbox.setAttribute("searchAttribute", val);
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.Priority)
+ else if (val == Ci.nsMsgSearchAttrib.Priority)
this.setAttribute("selectedIndex", "1");
- else if (val == Components.interfaces.nsMsgSearchAttrib.MsgStatus)
+ else if (val == Ci.nsMsgSearchAttrib.MsgStatus)
this.setAttribute("selectedIndex", "2");
- else if (val == Components.interfaces.nsMsgSearchAttrib.Date)
+ else if (val == Ci.nsMsgSearchAttrib.Date)
this.setAttribute("selectedIndex", "3");
- else if (val == Components.interfaces.nsMsgSearchAttrib.Sender) {
+ else if (val == Ci.nsMsgSearchAttrib.Sender) {
// since the internalOperator is null
// this is the same as the initial state
// the initial state for Sender isn't an ab type search
// it's a text search, so show the textbox
this.setAttribute("selectedIndex", "0");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.Keywords) {
+ else if (val == Ci.nsMsgSearchAttrib.Keywords) {
this.setAttribute("selectedIndex", "5");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.JunkStatus) {
+ else if (val == Ci.nsMsgSearchAttrib.JunkStatus) {
this.setAttribute("selectedIndex", "6");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.HasAttachmentStatus) {
+ else if (val == Ci.nsMsgSearchAttrib.HasAttachmentStatus) {
this.setAttribute("selectedIndex", "7");
}
- else if (val == Components.interfaces.nsMsgSearchAttrib.JunkScoreOrigin) {
+ else if (val == Ci.nsMsgSearchAttrib.JunkScoreOrigin) {
this.setAttribute("selectedIndex", "8");
}
else {
// a normal text field
this.setAttribute("selectedIndex", "0");
}
return val;
]]>
</setter>
</property>
<property name="value" onget="return this.internalValue;">
<setter>
<![CDATA[
// val is a nsIMsgSearchValue object
this.internalValue = val;
var attrib = this.internalAttribute;
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
+ var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
var children = document.getAnonymousNodes(this);
this.searchAttribute = attrib;
if (isNaN(attrib)) // a custom term
{
let customHbox = document.getAnonymousNodes(this)[9];
customHbox.setAttribute("value", val.str);
return val;
}
@@ -1368,18 +1368,18 @@
else if (attrib == nsMsgSearchAttrib.Date)
children[3].value = convertPRTimeToString(val.date);
else if (attrib == nsMsgSearchAttrib.Sender ||
attrib == nsMsgSearchAttrib.To ||
attrib == nsMsgSearchAttrib.CC ||
attrib == nsMsgSearchAttrib.AllAddresses ||
attrib == nsMsgSearchAttrib.ToOrCC)
{
- if (this.internalOperator == Components.interfaces.nsMsgSearchOp.IsntInAB ||
- this.internalOperator == Components.interfaces.nsMsgSearchOp.IsInAB) {
+ if (this.internalOperator == Ci.nsMsgSearchOp.IsntInAB ||
+ this.internalOperator == Ci.nsMsgSearchOp.IsInAB) {
var abs = children[4].getElementsByAttribute("value", val.str);
if (abs.item(0))
children[4].selectedItem = abs[0];
}
else
children[0].value = val.str;
}
else if (attrib == nsMsgSearchAttrib.Keywords)
@@ -1421,17 +1421,17 @@
]]>
</setter>
</property>
<method name="save">
<body>
<![CDATA[
var searchValue = this.value;
var searchAttribute = this.searchAttribute;
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
+ var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
var children = document.getAnonymousNodes(this);
searchValue.attrib = searchAttribute;
if (searchAttribute == nsMsgSearchAttrib.Priority) {
searchValue.priority = children[1].selectedItem.value;
}
else if (searchAttribute == nsMsgSearchAttrib.MsgStatus)
searchValue.status = children[2].value;
@@ -1440,18 +1440,18 @@
else if (searchAttribute == nsMsgSearchAttrib.Date)
searchValue.date = convertStringToPRTime(children[3].value);
else if (searchAttribute == nsMsgSearchAttrib.Sender ||
searchAttribute == nsMsgSearchAttrib.To ||
searchAttribute == nsMsgSearchAttrib.CC ||
searchAttribute == nsMsgSearchAttrib.AllAddresses ||
searchAttribute == nsMsgSearchAttrib.ToOrCC)
{
- if (this.internalOperator == Components.interfaces.nsMsgSearchOp.IsntInAB ||
- this.internalOperator == Components.interfaces.nsMsgSearchOp.IsInAB)
+ if (this.internalOperator == Ci.nsMsgSearchOp.IsntInAB ||
+ this.internalOperator == Ci.nsMsgSearchOp.IsInAB)
searchValue.str = children[4].selectedItem.value;
else
searchValue.str = children[0].value;
}
else if (searchAttribute == nsMsgSearchAttrib.Keywords)
{
searchValue.str = children[5].value;
}
@@ -1484,18 +1484,18 @@
]]>
</body>
</method>
<method name="fillInTags">
<body>
<![CDATA[
var children = document.getAnonymousNodes(this);
var popupMenu = children[5].firstChild;
- var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
- .getService(Components.interfaces.nsIMsgTagService);
+ var tagService = Cc["@mozilla.org/messenger/tagservice;1"]
+ .getService(Ci.nsIMsgTagService);
var tagArray = tagService.getAllTags({});
for (var i = 0; i < tagArray.length; ++i)
{
var taginfo = tagArray[i];
var newMenuItem = document.createElement('menuitem');
newMenuItem.setAttribute('label', taginfo.tag);
newMenuItem.setAttribute('value', taginfo.key);
popupMenu.appendChild(newMenuItem);
@@ -1530,30 +1530,30 @@
<![CDATA[
this.fillStringsForChildren(menulist.firstChild, bundle);
]]>
</body>
</method>
<constructor>
<![CDATA[
// initialize strings
- var bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
+ var bundle = Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
.createBundle("chrome://messenger/locale/messenger.properties");
// intialize the priority picker
this.initialize(document.getAnonymousNodes(this)[1], bundle);
// initialize the status picker
this.initialize(document.getAnonymousNodes(this)[2], bundle);
// initialize the date picker
var datePicker = document.getAnonymousNodes(this)[3];
var searchAttribute = this.searchAttribute;
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
+ var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
var time;
if (searchAttribute == nsMsgSearchAttrib.Date)
time = datePicker.value;
else
time = new Date();
// do .value instead of .setAttribute("value", xxx);
// to work around for bug #179412
// (caused by bug #157210)
@@ -1750,17 +1750,17 @@
view.toggleOpenState(i);
}
}
}
}
var index = -1;
var uri = this.parentNode.getAttribute("uri");
if (uri) {
- var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
+ var RDF = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
index = view.getIndexOfResource(RDF.GetResource(uri));
}
view.selection.select(index);
return index;
]]>
</body>
</method>
<constructor>
@@ -1808,24 +1808,24 @@
<handlers>
<handler event="popupshowing">
<![CDATA[
var folderTree = GetFolderTree();
var { row, col } = folderTree.treeBoxObject.getCellAt(event.clientX, event.clientY);
if (row == -1)
return false;
- var msgFolder = GetFolderResource(folderTree, row).QueryInterface(Components.interfaces.nsIMsgFolder);
+ var msgFolder = GetFolderResource(folderTree, row).QueryInterface(Ci.nsIMsgFolder);
var server = msgFolder.server;
var popupValue = null;
// Use the full newsgroup name as tooltip for abbreviated newsgroups.
// Else show full cell content as tooltip for cropped cells.
if (col.id == "folderNameCol" && !msgFolder.isServer &&
- !(msgFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual) &&
- (server instanceof Components.interfaces.nsINntpIncomingServer) &&
+ !(msgFolder.flags & Ci.nsMsgFolderFlags.Virtual) &&
+ (server instanceof Ci.nsINntpIncomingServer) &&
server.abbreviate)
{
popupValue = msgFolder.name;
}
else if (folderTree.treeBoxObject.isCellCropped(row, col))
{
popupValue = folderTree.view.getCellText(row, col);
}
@@ -1861,35 +1861,35 @@
<method name="parseFolder">
<parameter name="aFolder"/>
<parameter name="aUrlListener"/>
<parameter name="aOutAsync"/>
<body>
<![CDATA[
// skip servers, Trash and Junk folders
if (!aFolder || aFolder.isServer ||
- aFolder.getFlag(Components.interfaces.nsMsgFolderFlags.Junk) ||
- aFolder.getFlag(Components.interfaces.nsMsgFolderFlags.Trash))
+ aFolder.getFlag(Ci.nsMsgFolderFlags.Junk) ||
+ aFolder.getFlag(Ci.nsMsgFolderFlags.Trash))
return false;
- var pref = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+ var pref = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch);
var showPreviewText = pref.getBoolPref("mail.biff.alert.show_preview");
var folderArray = new Array;
- if (aFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual)
+ if (aFolder.flags & Ci.nsMsgFolderFlags.Virtual)
{
var dbFolderInfo = aFolder.msgDatabase.dBFolderInfo;
var srchFolderUri = dbFolderInfo.getCharProperty("searchFolderUri");
var srchFolderUriArray = srchFolderUri.split('|');
var foldersAdded = 0;
- var RDF = Components.classes['@mozilla.org/rdf/rdf-service;1']
- .getService(Components.interfaces.nsIRDFService);
+ var RDF = Cc['@mozilla.org/rdf/rdf-service;1']
+ .getService(Ci.nsIRDFService);
for (var i in srchFolderUriArray)
{
var realFolder = RDF.GetResource(srchFolderUriArray[i])
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
if (!realFolder.isServer)
folderArray[foldersAdded++] = realFolder;
}
}
else
folderArray[0] = aFolder;
var foundNewMsg = false;
for (var folderIndex = 0; folderIndex < folderArray.length; folderIndex++)
@@ -1922,24 +1922,24 @@
}
}
// if fetching the preview text is going to be an asynch operation and the caller
// is set up to handle that fact, then don't bother filling in any of the fields since
// we'll have to do this all over again when the fetch for the preview text completes.
// We don't expect to get called with a urlListener if we're doing a virtual folder.
if (aOutAsync.value && aUrlListener)
return false;
- var unicodeConverter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
- .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
+ var unicodeConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
+ .createInstance(Ci.nsIScriptableUnicodeConverter);
unicodeConverter.charset = "UTF-8";
foundNewMsg = true;
var index = 0;
- var hdrParser = Components.classes["@mozilla.org/messenger/headerparser;1"]
- .getService(Components.interfaces.nsIMsgHeaderParser);
+ var hdrParser = Cc["@mozilla.org/messenger/headerparser;1"]
+ .getService(Ci.nsIMsgHeaderParser);
while (document.getAnonymousNodes(this)[0].childNodes.length < this.mMaxMsgHdrsInPopup && index < numMsgKeys.value)
{
var msgPopup = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "folderSummaryMessage");
var msgHdr = msgDatabase.GetMsgHdrForKey(msgKeys.value[index++]);
var msgSubject = msgHdr.mime2DecodedSubject;
const kMsgFlagHasRe = 0x0010; // MSG_FLAG_HAS_RE
if(msgHdr.flags & kMsgFlagHasRe)
@@ -1998,36 +1998,36 @@
<xul:spring anonid="spring" flex="100%"/>
</xul:hbox>
<xul:description anonid="preview" class="folderSummary-message-row folderSummary-previewText" xbl:inherits="value=previewText" crop="right"></xul:description>
</xul:vbox>
</content>
<implementation>
<constructor>
<![CDATA[
- var pref = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+ var pref = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch);
if (!pref.getBoolPref("mail.biff.alert.show_preview"))
document.getAnonymousElementByAttribute(this, "anonid", "preview").hidden = true;
var hideSubject = !pref.getBoolPref("mail.biff.alert.show_subject");
var hideSender = !pref.getBoolPref("mail.biff.alert.show_sender");
if (hideSubject)
document.getAnonymousElementByAttribute(this, "anonid", "subject").hidden = true;
if (hideSender)
document.getAnonymousElementByAttribute(this, "anonid", "sender").hidden = true;
if (hideSubject && hideSender)
document.getAnonymousElementByAttribute(this, "anonid", "spring").hidden = true;
]]>
</constructor>
</implementation>
<handlers>
<handler event="click" button="0">
<![CDATA[
- var mailSession = Components.classes["@mozilla.org/messenger/services/session;1"].
- getService(Components.interfaces.nsIMsgMailSession);
+ var mailSession = Cc["@mozilla.org/messenger/services/session;1"].
+ getService(Ci.nsIMsgMailSession);
var topmostMsgWindow;
try {
topmostMsgWindow = mailSession.topmostMsgWindow;
} catch (ex) {}
if (topmostMsgWindow)
{
// Bring window to the front
@@ -2037,18 +2037,18 @@
// SelectFolder throws an exception if the folder is not in the current folder view
mailSession.topmostMsgWindow.windowCommands.selectFolder(this.folderUri);
mailSession.topmostMsgWindow.windowCommands.selectMessage(this.messageUri);
} catch (ex) {}
}
else
{
// open a new window
- var mailWindowService = Components.classes["@mozilla.org/messenger/windowservice;1"].
- getService(Components.interfaces.nsIMessengerWindowService);
+ var mailWindowService = Cc["@mozilla.org/messenger/windowservice;1"].
+ getService(Ci.nsIMessengerWindowService);
mailWindowService.openMessengerWindowWithUri("mail:3pane", this.folderUri, this.msgKey);
}
if (gAlertListener)
gAlertListener.observe(null, "alertclicksimplecallback", "");
]]>
</handler>
</handlers>
--- a/suite/mailnews/mailWindow.js
+++ b/suite/mailnews/mailWindow.js
@@ -46,19 +46,19 @@ function OnMailWindowUnload()
gPreQuickSearchView.close();
}
var dbview = GetDBView();
if (dbview) {
dbview.close();
}
- var mailSession = Components.classes["@mozilla.org/messenger/services/session;1"]
- .getService();
- if (mailSession instanceof Components.interfaces.nsIMsgMailSession)
+ var mailSession = Cc["@mozilla.org/messenger/services/session;1"]
+ .getService();
+ if (mailSession instanceof Ci.nsIMsgMailSession)
mailSession.RemoveFolderListener(folderListener);
mailSession.RemoveMsgWindow(msgWindow);
messenger.setWindow(null, null);
msgWindow.closeWindow();
}
/**
@@ -129,21 +129,21 @@ function onCopyOrDragStart(e) {
for (let img of images) {
if (!imgMap.has(img.src)) {
continue;
}
img.src = imgMap.get(img.src);
}
let html = div.innerHTML;
- let parserUtils = Components.classes["@mozilla.org/parserutils;1"]
- .getService(Components.interfaces.nsIParserUtils);
+ let parserUtils = Cc["@mozilla.org/parserutils;1"]
+ .getService(Ci.nsIParserUtils);
let plain =
parserUtils.convertToPlainText(html,
- Components.interfaces.nsIDocumentEncoder.OutputForPlainTextClipboardCopy,
+ Ci.nsIDocumentEncoder.OutputForPlainTextClipboardCopy,
0);
// Copy operation.
if ("clipboardData" in e) {
e.clipboardData.setData("text/html", html);
e.clipboardData.setData("text/plain", plain);
e.preventDefault();
}
@@ -152,65 +152,65 @@ function onCopyOrDragStart(e) {
e.dataTransfer.setData("text/html", html);
e.dataTransfer.setData("text/plain", plain);
}
}
function CreateMailWindowGlobals()
{
// Get the messenger instance.
- messenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ messenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
// Create windows status feedback
// set the JS implementation of status feedback before creating the c++ one..
window.MsgStatusFeedback = new nsMsgStatusFeedback();
// Double register the status feedback object as the xul browser window
// implementation.
- window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShellTreeItem).treeOwner
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIXULWindow)
+ window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem).treeOwner
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIXULWindow)
.XULBrowserWindow = window.MsgStatusFeedback;
- statusFeedback = Components.classes["@mozilla.org/messenger/statusfeedback;1"]
- .createInstance(Components.interfaces.nsIMsgStatusFeedback);
+ statusFeedback = Cc["@mozilla.org/messenger/statusfeedback;1"]
+ .createInstance(Ci.nsIMsgStatusFeedback);
statusFeedback.setWrappedStatusFeedback(window.MsgStatusFeedback);
window.MsgWindowCommands = new nsMsgWindowCommands();
//Create message window object
- msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(Components.interfaces.nsIMsgWindow);
+ msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
+ .createInstance(Ci.nsIMsgWindow);
- msgComposeService = Components.classes['@mozilla.org/messengercompose;1']
- .getService(Components.interfaces.nsIMsgComposeService);
+ msgComposeService = Cc['@mozilla.org/messengercompose;1']
+ .getService(Ci.nsIMsgComposeService);
- mailSession = Components.classes["@mozilla.org/messenger/services/session;1"].getService(Components.interfaces.nsIMsgMailSession);
+ mailSession = Cc["@mozilla.org/messenger/services/session;1"].getService(Ci.nsIMsgMailSession);
- accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
+ accountManager = Cc["@mozilla.org/messenger/account-manager;1"].getService(Ci.nsIMsgAccountManager);
- RDF = Components.classes['@mozilla.org/rdf/rdf-service;1']
- .getService(Components.interfaces.nsIRDFService);
+ RDF = Cc['@mozilla.org/rdf/rdf-service;1']
+ .getService(Ci.nsIRDFService);
- msgComposeType = Components.interfaces.nsIMsgCompType;
- msgComposeFormat = Components.interfaces.nsIMsgCompFormat;
+ msgComposeType = Ci.nsIMsgCompType;
+ msgComposeFormat = Ci.nsIMsgCompFormat;
gMessengerBundle = document.getElementById("bundle_messenger");
gBrandBundle = document.getElementById("bundle_brand");
//Create datasources
var prefix = "@mozilla.org/rdf/datasource;1?name=";
var accountManagerDSCID = prefix + "msgaccountmanager";
var folderDSCID = prefix + "mailnewsfolders";
- var nsIRDFDataSource = Components.interfaces.nsIRDFDataSource;
+ var nsIRDFDataSource = Ci.nsIRDFDataSource;
- accountManagerDataSource = Components.classes[accountManagerDSCID].getService(nsIRDFDataSource);
- folderDataSource = Components.classes[folderDSCID].getService(nsIRDFDataSource);
+ accountManagerDataSource = Cc[accountManagerDSCID].getService(nsIRDFDataSource);
+ folderDataSource = Cc[folderDSCID].getService(nsIRDFDataSource);
msgWindow.notificationCallbacks = new nsMsgBadCertHandler();
}
function InitMsgWindow()
{
msgWindow.windowCommands = new nsMsgWindowCommands();
// set the domWindow before setting the status feedback and header sink objects
@@ -218,17 +218,17 @@ function InitMsgWindow()
msgWindow.statusFeedback = statusFeedback;
msgWindow.msgHeaderSink = messageHeaderSink;
mailSession.AddMsgWindow(msgWindow);
var messagepane = getMessageBrowser();
messagepane.docShell.allowAuth = false;
messagepane.docShell.allowDNSPrefetch = false;
msgWindow.rootDocShell.allowAuth = true;
- msgWindow.rootDocShell.appType = Components.interfaces.nsIDocShell.APP_TYPE_MAIL;
+ msgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
// Ensure we don't load xul error pages into the main window
msgWindow.rootDocShell.useErrorPages = false;
document.addEventListener("copy", onCopyOrDragStart, true);
document.addEventListener("dragstart", onCopyOrDragStart, true);
}
function messagePaneOnResize(event)
@@ -270,21 +270,21 @@ function messagePaneOnClick(event)
// try to determine the href for what you are clicking on.
// for example, it might be "" if you aren't left clicking on a link
var ceParams = hrefAndLinkNodeForClickEvent(event);
if (!ceParams && !event.button)
{
var target = event.target;
// is this an image that we might want to scale?
- if (target instanceof Components.interfaces.nsIImageLoadingContent)
+ if (target instanceof Ci.nsIImageLoadingContent)
{
// make sure it loaded successfully
- var req = target.getRequest(Components.interfaces.nsIImageLoadingContent.CURRENT_REQUEST);
- if (!req || req.imageStatus & Components.interfaces.imgIRequest.STATUS_ERROR)
+ var req = target.getRequest(Ci.nsIImageLoadingContent.CURRENT_REQUEST);
+ if (!req || req.imageStatus & Ci.imgIRequest.STATUS_ERROR)
return true;
// is it an inline attachment?
if (/^moz-attached-image/.test(target.className))
{
if (target.hasAttribute("isshrunk"))
{
// currently shrunk to fit, so unshrink it
target.removeAttribute("isshrunk");
@@ -313,18 +313,18 @@ function messagePaneOnClick(event)
var needABrowser = /(^http(s)?:|^ftp:|^file:|^chrome:|^resource:|^about:)/i;
if (href.search(needABrowser) == -1)
return true;
// however, if the protocol should not be loaded internally, then we should
// not put up a new browser window. we should just let the usual processing
// take place.
try {
- var extProtService = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
- .getService(Components.interfaces.nsIExternalProtocolService);
+ var extProtService = Cc["@mozilla.org/uriloader/external-protocol-service;1"]
+ .getService(Ci.nsIExternalProtocolService);
var scheme = href.substring(0, href.indexOf(":"));
if (!extProtService.isExposedProtocol(scheme))
return true;
}
catch (ex) {} // ignore errors, and just assume that we can proceed.
// if you get here, the user did a simple left click on a link
// that we know should be in a browser window.
@@ -406,22 +406,22 @@ nsMsgStatusFeedback.prototype =
// Called before links are navigated to to allow us to retarget them if needed.
onBeforeLinkTraversal: function(aOriginalTarget, aLinkURI, aLinkNode, aIsAppTab)
{
return aOriginalTarget;
},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIMsgStatusFeedback) ||
- iid.equals(Components.interfaces.nsIXULBrowserWindow) ||
- iid.equals(Components.interfaces.nsISupportsWeakReference) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIMsgStatusFeedback) ||
+ iid.equals(Ci.nsIXULBrowserWindow) ||
+ iid.equals(Ci.nsISupportsWeakReference) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
// nsIMsgStatusFeedback implementation.
showStatusString : function(statusText)
{
this.ensureStatusFields();
if ( !statusText.length )
statusText = this.myDefaultStatus;
@@ -535,20 +535,20 @@ nsMsgStatusFeedback.prototype =
function nsMsgWindowCommands()
{
}
nsMsgWindowCommands.prototype =
{
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIMsgWindowCommands) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIMsgWindowCommands) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
selectFolder: function(folderUri)
{
SelectFolder(folderUri);
},
selectMessage: function(messageUri)
--- a/suite/mailnews/mailWindowOverlay.js
+++ b/suite/mailnews/mailWindowOverlay.js
@@ -28,28 +28,28 @@ var kAllowRemoteContent = 2;
var kIsAPhishMessage = 0;
var kNotAPhishMessage = 1;
var kMsgForwardAsAttachment = 0;
var gMessengerBundle;
var gOfflineManager;
-var gCopyService = Components.classes["@mozilla.org/messenger/messagecopyservice;1"]
- .getService(Components.interfaces.nsIMsgCopyService);
+var gCopyService = Cc["@mozilla.org/messenger/messagecopyservice;1"]
+ .getService(Ci.nsIMsgCopyService);
var gMarkViewedMessageAsReadTimer = null; // if the user has configured the app to mark a message as read if it is viewed for more than n seconds
var gTimelineService = null;
var gTimelineEnabled = ("@mozilla.org;timeline-service;1" in Components.classes);
if (gTimelineEnabled) {
try {
gTimelineEnabled = Services.prefs.getBoolPref("mailnews.timeline_is_enabled");
if (gTimelineEnabled) {
gTimelineService =
- Components.classes["@mozilla.org;timeline-service;1"].getService(Components.interfaces.nsITimelineService);
+ Cc["@mozilla.org;timeline-service;1"].getService(Ci.nsITimelineService);
}
}
catch (ex)
{
gTimelineEnabled = false;
}
}
@@ -73,17 +73,17 @@ function menu_new_init()
var folderArray = GetSelectedMsgFolders();
if (folderArray.length == 0)
return;
var msgFolder = folderArray[0];
var isServer = msgFolder.isServer;
var serverType = msgFolder.server.type;
var canCreateNew = msgFolder.canCreateSubfolders;
var isInbox = msgFolder.isSpecialFolder(
- Components.interfaces.nsMsgFolderFlags.Inbox, false);
+ Ci.nsMsgFolderFlags.Inbox, false);
var isIMAPFolder = serverType == "imap";
var showNew = ((serverType != 'nntp') && canCreateNew) || isInbox;
ShowMenuItem("menu_newFolder", showNew);
ShowMenuItem("menu_newVirtualFolder", showNew);
EnableMenuItem("menu_newFolder", !isIMAPFolder || !Services.io.offline);
EnableMenuItem("menu_newVirtualFolder", true);
if (showNew)
SetMenuItemLabel("menu_newFolder", gMessengerBundle.getString((isServer || isInbox) ? "newFolderMenuItem" : "newSubfolderMenuItem"));
@@ -497,20 +497,20 @@ function SetMenuItemLabel(menuItemId, cu
}
function RemoveAllMessageTags()
{
var selectedMessages = gFolderDisplay.selectedMessages;
if (!selectedMessages.length)
return;
- var messages = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
- var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
- .getService(Components.interfaces.nsIMsgTagService);
+ var messages = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
+ var tagService = Cc["@mozilla.org/messenger/tagservice;1"]
+ .getService(Ci.nsIMsgTagService);
var tagArray = tagService.getAllTags({});
var allKeys = "";
for (let j = 0; j < tagArray.length; ++j)
{
if (j)
allKeys += " ";
allKeys += tagArray[j].key;
@@ -544,19 +544,19 @@ function RemoveAllMessageTags()
function InitNewMsgMenu(aPopup)
{
var identity = null;
var folder = GetFirstSelectedMsgFolder();
if (folder)
identity = getIdentityForServer(folder.server);
if (!identity)
- identity = Components.classes["@mozilla.org/messenger/account-manager;1"]
- .getService(Components.interfaces.nsIMsgAccountManager)
- .defaultAccount.defaultIdentity;
+ identity = Cc["@mozilla.org/messenger/account-manager;1"]
+ .getService(Ci.nsIMsgAccountManager)
+ .defaultAccount.defaultIdentity;
// If the identity is not found, use the mail.html_compose pref to
// determine the message compose type (HTML or PlainText).
var composeHTML = identity ? identity.composeHtml
: Services.prefs.getBoolPref("mail.html_compose");
const kIDs = {true: "button-newMsgHTML", false: "button-newMsgPlain"};
document.getElementById(kIDs[composeHTML]).setAttribute("default", "true");
document.getElementById(kIDs[!composeHTML]).removeAttribute("default");
}
@@ -592,18 +592,18 @@ function InitMessageForward(aPopup)
function ToggleMessageTagKey(index)
{
// toggle the tag state based upon that of the first selected message
var msgHdr = gFolderDisplay.selectedMessage;
if (!msgHdr)
return;
- var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
- .getService(Components.interfaces.nsIMsgTagService);
+ var tagService = Cc["@mozilla.org/messenger/tagservice;1"]
+ .getService(Ci.nsIMsgTagService);
var tagArray = tagService.getAllTags({});
for (var i = 0; i < tagArray.length; ++i)
{
var key = tagArray[i].key;
if (!--index)
{
// found the key, now toggle its state
var curKeys = msgHdr.getStringProperty("keywords");
@@ -620,20 +620,20 @@ function ToggleMessageTagMenu(target)
{
var key = target.getAttribute("value");
var addKey = target.getAttribute("checked") == "true";
ToggleMessageTag(key, addKey);
}
function ToggleMessageTag(key, addKey)
{
- var messages = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
- var msg = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var messages = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
+ var msg = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
var selectedMessages = gFolderDisplay.selectedMessages;
var toggler = addKey ? "addKeywordsToMessages" : "removeKeywordsFromMessages";
var prevHdrFolder = null;
// this crudely handles cross-folder virtual folders with selected messages
// that spans folders, by coalescing consecutive msgs in the selection
// that happen to be in the same folder. nsMsgSearchDBView does this
// better, but nsIMsgDBView doesn't handle commands with arguments,
// and (un)tag takes a key argument.
@@ -674,18 +674,18 @@ function SetMessageTagLabel(menuitem, in
menuitem.setAttribute("accesskey", accesskey);
var label = gMessengerBundle.getFormattedString("mailnews.tags.format",
[accesskey, name]);
menuitem.setAttribute("label", label);
}
function InitMessageTags(menuPopup)
{
- var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
- .getService(Components.interfaces.nsIMsgTagService);
+ var tagService = Cc["@mozilla.org/messenger/tagservice;1"]
+ .getService(Ci.nsIMsgTagService);
var tagArray = tagService.getAllTags({});
var tagCount = tagArray.length;
// remove any existing non-static entries...
var menuseparator = menuPopup.lastChild.previousSibling;
for (var i = menuPopup.childNodes.length; i > 4; --i)
menuseparator.previousSibling.remove();
@@ -756,17 +756,17 @@ function PopulateHistoryMenu(menuPopup,
{
var menuText = "";
let folder = GetMsgFolderFromUri(historyArray[i * 2 + 1]);
if (!IsCurrentLoadedFolder(folder))
menuText += folder.prettyName + ": ";
var msgHdr = messenger.msgHdrFromURI(historyArray[i * 2]);
var subject = "";
- if (msgHdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe)
+ if (msgHdr.flags & Ci.nsMsgMessageFlags.HasRe)
subject = "Re: ";
if (msgHdr.mime2DecodedSubject)
subject += msgHdr.mime2DecodedSubject;
if (subject)
menuText += subject + " - ";
menuText += msgHdr.mime2DecodedAuthor;
var newMenuItem = document.createElement('menuitem');
@@ -844,17 +844,17 @@ function UpdateDeleteCommand()
goSetAccessKey("cmd_delete", value + "AccessKey");
}
function SelectedMessagesAreDeleted()
{
var firstSelectedMessage = gFolderDisplay.selectedMessage;
return firstSelectedMessage &&
(firstSelectedMessage.flags &
- Components.interfaces.nsMsgMessageFlags.IMAPDeleted);
+ Ci.nsMsgMessageFlags.IMAPDeleted);
}
function SelectedMessagesAreJunk()
{
var firstSelectedMessage = gFolderDisplay.selectedMessage;
if (!firstSelectedMessage)
return false;
@@ -895,17 +895,17 @@ function GetFirstSelectedMsgFolder()
}
function GetInboxFolder(server)
{
try {
var rootMsgFolder = server.rootMsgFolder;
//now find Inbox
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
return rootMsgFolder.getFolderWithFlags(nsMsgFolderFlags.Inbox);
}
catch (ex) {
dump(ex + "\n");
}
return null;
}
@@ -976,18 +976,18 @@ function MsgDeleteMessage(aReallyDelete)
// ensures that we clear the biff indicator from the system tray when
// the user deletes the new message.
if (Services.prefs.getBoolPref("mailnews.ui.deleteMarksRead"))
MarkSelectedMessagesRead(true);
SetNextMessageAfterDelete();
// determine if we're using the IMAP delete model
var server = GetFirstSelectedMsgFolder().server;
- const kIMAPDelete = Components.interfaces.nsMsgImapDeleteModels.IMAPDelete;
- var imapDeleteModelUsed = server instanceof Components.interfaces.nsIImapIncomingServer &&
+ const kIMAPDelete = Ci.nsMsgImapDeleteModels.IMAPDelete;
+ var imapDeleteModelUsed = server instanceof Ci.nsIImapIncomingServer &&
server.deleteModel == kIMAPDelete;
// execute deleteNoTrash only if IMAP delete model is not used
if (aReallyDelete && !imapDeleteModelUsed)
gDBView.doCommand(nsMsgViewCommandType.deleteNoTrash);
else
gDBView.doCommand(nsMsgViewCommandType.deleteMsg);
}
@@ -995,19 +995,19 @@ function MsgDeleteMessage(aReallyDelete)
function MsgCopyMessage(destFolder)
{
try {
// get the msg folder we're copying messages into
var destUri = destFolder.getAttribute('id');
let destMsgFolder = GetMsgFolderFromUri(destUri);
if (gMessageDisplay.isDummy)
{
- let file = window.arguments[0].QueryInterface(Components.interfaces.nsIFileURL).file;
+ let file = window.arguments[0].QueryInterface(Ci.nsIFileURL).file;
MailServices.copy.CopyFileMessage(file, destMsgFolder, null, false,
- Components.interfaces.nsMsgMessageFlags.Read,
+ Ci.nsMsgMessageFlags.Read,
"", null, msgWindow);
}
else
{
gDBView.doCommandWithFolder(nsMsgViewCommandType.copyMessages, destMsgFolder);
}
}
catch (ex) {
@@ -1139,17 +1139,17 @@ BatchMessageMover.prototype =
archiveFolderUri = server.serverURI + "/Archives";
archiveGranularity =
Services.prefs.getIntPref("mail.identity.default.archive_granularity");
archiveKeepFolderStructure =
Services.prefs.getBoolPref("mail.identity.default.archive_keep_folder_structure");
}
else {
let identity = GetIdentityForHeader(msgHdr,
- Components.interfaces.nsIMsgCompType.ReplyAll);
+ Ci.nsIMsgCompType.ReplyAll);
archiveFolderUri = identity.archiveFolder;
archiveGranularity = identity.archiveGranularity;
archiveKeepFolderStructure = identity.archiveKeepFolderStructure;
}
let archiveFolder = GetMsgFolderFromUri(archiveFolderUri, false);
let copyBatchKey = msgHdr.folder.URI + '\000' + monthFolderName;
if (!(copyBatchKey in this._batches))
@@ -1157,124 +1157,124 @@ BatchMessageMover.prototype =
archiveFolderUri,
archiveGranularity,
archiveKeepFolderStructure,
msgYear,
monthFolderName];
this._batches[copyBatchKey].push(msgHdr);
}
- let notificationService = Components.classes["@mozilla.org/messenger/msgnotificationservice;1"]
- .getService(Components.interfaces.nsIMsgFolderNotificationService);
+ let notificationService = Cc["@mozilla.org/messenger/msgnotificationservice;1"]
+ .getService(Ci.nsIMsgFolderNotificationService);
notificationService.addListener(this, notificationService.folderAdded);
// Now we launch the code iterating over all message copies, one in turn.
this.processNextBatch();
},
processNextBatch: function()
{
for (let key in this._batches) {
this._currentBatch = this._batches[key];
delete this._batches[key];
return this.filterBatch();
}
// all done
- Components.classes["@mozilla.org/messenger/msgnotificationservice;1"]
- .getService(Components.interfaces.nsIMsgFolderNotificationService)
- .removeListener(this);
+ Cc["@mozilla.org/messenger/msgnotificationservice;1"]
+ .getService(Ci.nsIMsgFolderNotificationService)
+ .removeListener(this);
// We're just going to select the message now.
- let treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ let treeView = gDBView.QueryInterface(Ci.nsITreeView);
treeView.selection.select(this.messageToSelectAfterWereDone);
treeView.selectionChanged();
return;
},
filterBatch: function()
{
let batch = this._currentBatch;
let msgs = batch.slice(6);
- let filterArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let filterArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
for (let message of msgs) {
filterArray.appendElement(message);
}
// Apply filters to this batch.
let srcFolder = batch[0];
MailServices.filters.applyFilters(
- Components.interfaces.nsMsgFilterType.Archive,
+ Ci.nsMsgFilterType.Archive,
filterArray, srcFolder, msgWindow, this);
return; // continues with onStopOperation
},
onStopOperation: function(aResult)
{
if (!Components.isSuccessCode(aResult))
{
- Components.utils.reportError("Archive filter failed: " + aResult);
+ Cu.reportError("Archive filter failed: " + aResult);
// We don't want to effectively disable archiving because a filter
// failed, so we'll continue after reporting the error.
}
// Now do the default archive processing
this.continueBatch();
},
// continue processing of default archive operations
continueBatch: function()
{
let batch = this._currentBatch;
let [srcFolder, archiveFolderUri, granularity, keepFolderStructure, msgYear, msgMonth] = batch;
let msgs = batch.slice(6);
- let moveArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let moveArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
// Don't move any items that the filter moves or deleted
for (let item of msgs) {
if (srcFolder.msgDatabase.ContainsKey(item.messageKey) &&
!(srcFolder.getProcessingFlags(item.messageKey) &
- Components.interfaces.nsMsgProcessingFlags.FilterToMove)) {
+ Ci.nsMsgProcessingFlags.FilterToMove)) {
moveArray.appendElement(item);
}
}
if (moveArray.length == 0)
return this.processNextBatch(); // continue processing
let archiveFolder = GetMsgFolderFromUri(archiveFolderUri, false);
let dstFolder = archiveFolder;
// For folders on some servers (e.g. IMAP), we need to create the
// sub-folders asynchronously, so we chain the urls using the listener
// called back from createStorageIfMissing. For local,
// createStorageIfMissing is synchronous.
let isAsync = archiveFolder.server.protocolInfo.foldersCreatedAsync;
if (!archiveFolder.parent)
{
- archiveFolder.setFlag(Components.interfaces.nsMsgFolderFlags.Archive);
+ archiveFolder.setFlag(Ci.nsMsgFolderFlags.Archive);
archiveFolder.createStorageIfMissing(this);
if (isAsync)
return; // continues with OnStopRunningUrl
}
if (!archiveFolder.canCreateSubfolders)
- granularity = Components.interfaces.nsIMsgIdentity.singleArchiveFolder;
- if (granularity >= Components.interfaces.nsIMsgIdentity.perYearArchiveFolders)
+ granularity = Ci.nsIMsgIdentity.singleArchiveFolder;
+ if (granularity >= Ci.nsIMsgIdentity.perYearArchiveFolders)
{
archiveFolderUri += "/" + msgYear;
dstFolder = GetMsgFolderFromUri(archiveFolderUri, false);
if (!dstFolder.parent)
{
dstFolder.createStorageIfMissing(this);
if (isAsync)
return; // continues with OnStopRunningUrl
}
}
- if (granularity >= Components.interfaces.nsIMsgIdentity.perMonthArchiveFolders)
+ if (granularity >= Ci.nsIMsgIdentity.perMonthArchiveFolders)
{
archiveFolderUri += "/" + msgMonth;
dstFolder = GetMsgFolderFromUri(archiveFolderUri, false);
if (!dstFolder.parent)
{
dstFolder.createStorageIfMissing(this);
if (isAsync)
return; // continues with OnStopRunningUrl
@@ -1340,17 +1340,17 @@ BatchMessageMover.prototype =
},
OnStopRunningUrl: function(aUrl, aExitCode)
{
// This will always be a create folder url, afaik.
if (Components.isSuccessCode(aExitCode))
this.continueBatch();
else
{
- Components.utils.reportError("Archive failed to create folder: " + aExitCode);
+ Cu.reportError("Archive failed to create folder: " + aExitCode);
this._batches = null;
this.processNextBatch(); // for cleanup and exit
}
},
// This also implements nsIMsgCopyServiceListener, but we only care
// about the OnStopCopy (CopyMessages callback).
OnStartCopy: function()
@@ -1368,17 +1368,17 @@ BatchMessageMover.prototype =
OnStopCopy: function(aStatus)
{
if (Components.isSuccessCode(aStatus))
{
return this.processNextBatch();
}
else
{
- Components.utils.reportError("Archive failed to copy: " + aStatus);
+ Cu.reportError("Archive failed to copy: " + aStatus);
this._batches = null;
this.processNextBatch(); // for cleanup and exit
}
},
// This also implements nsIMsgFolderListener, but we only care about the
// folderAdded (createSubfolder callback).
folderAdded: function(aFolder)
@@ -1390,23 +1390,23 @@ BatchMessageMover.prototype =
this._dstFolderParent = null;
this._dstFolderName = null;
this.continueBatch();
}
},
QueryInterface: function(aIID)
{
- if (aIID.equals(Components.interfaces.nsIUrlListener) ||
- aIID.equals(Components.interfaces.nsIMsgCopyServiceListener) ||
- aIID.equals(Components.interfaces.nsIMsgFolderListener) ||
- aIID.equals(Components.interfaces.nsIMsgOperationListener) ||
- aIID.equals(Components.interfaces.nsISupports))
+ if (aIID.equals(Ci.nsIUrlListener) ||
+ aIID.equals(Ci.nsIMsgCopyServiceListener) ||
+ aIID.equals(Ci.nsIMsgFolderListener) ||
+ aIID.equals(Ci.nsIMsgOperationListener) ||
+ aIID.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_ERROR_NO_INTERFACE;
+ throw Cr.NS_ERROR_NO_INTERFACE;
}
}
function MsgArchiveSelectedMessages(aEvent)
{
let batchMover = new BatchMessageMover();
batchMover.archiveMessages(gFolderDisplay.selectedMessages);
}
@@ -1444,17 +1444,17 @@ function MsgComposeDraftMessage()
{
ComposeMsgByType(msgComposeType.Draft, null, msgComposeFormat.Default);
}
function MsgCreateFilter()
{
// retrieve Sender direct from selected message's headers
var msgHdr = gFolderDisplay.selectedMessage;
- var headerParser = Components.classes["@mozilla.org/messenger/headerparser;1"].getService(Components.interfaces.nsIMsgHeaderParser);
+ var headerParser = Cc["@mozilla.org/messenger/headerparser;1"].getService(Ci.nsIMsgHeaderParser);
var emailAddress = headerParser.extractHeaderAddressMailboxes(msgHdr.author);
var accountKey = msgHdr.accountKey;
var folder;
if (accountKey.length > 0)
{
var account = accountManager.getAccount(accountKey);
if (account)
{
@@ -1486,17 +1486,17 @@ function MsgNewFolder(callBackFunctionNa
{
try {
server = preselectedFolder.server;
if (server)
{
destinationFolder = getDestinationFolder(preselectedFolder, server);
var imapServer =
- server.QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ server.QueryInterface(Ci.nsIImapIncomingServer);
if (imapServer)
dualUseFolders = imapServer.dualUseFolders;
}
} catch (e) {
dump ("Exception: dualUseFolders = true\n");
}
}
window.openDialog("chrome://messenger/content/newFolderDialog.xul",
@@ -1578,21 +1578,21 @@ function MsgSaveAsFile()
SaveAsFile(gFolderDisplay.selectedMessageUris);
}
function MsgSaveAsTemplate()
{
SaveAsTemplate(gFolderDisplay.selectedMessageUris);
}
-const nsIFilePicker = Components.interfaces.nsIFilePicker;
+const nsIFilePicker = Ci.nsIFilePicker;
function MsgOpenFromFile()
{
- var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
var filterLabel = gMessengerBundle.getString("EMLFiles");
var windowTitle = gMessengerBundle.getString("OpenEMLFiles");
fp.init(window, windowTitle, nsIFilePicker.modeOpen);
fp.appendFilter(filterLabel, "*.eml; *.msg");
// Default or last filter is "All Files"
@@ -1603,17 +1603,17 @@ function MsgOpenFromFile()
if (ret == nsIFilePicker.returnCancel)
return;
}
catch (ex) {
dump("filePicker.chooseInputFile threw an exception\n");
return;
}
- var uri = fp.fileURL.QueryInterface(Components.interfaces.nsIURL);
+ var uri = fp.fileURL.QueryInterface(Ci.nsIURL);
uri.query = "type=application/x-message-display";
window.openDialog( "chrome://messenger/content/messageWindow.xul", "_blank", "all,chrome,dialog=no,status,toolbar", uri, null, null );
}
function MsgOpenNewWindowForMsgHdr(hdr)
{
MsgOpenNewWindowForFolder(hdr.folder.URI, hdr.messageKey);
@@ -1629,17 +1629,17 @@ function MsgOpenNewWindowForFolder(uri,
// GetLoadedMsgFolder().URI.
// This is required because on a right-click, the currentIndex value will be
// different from the actual row that is highlighted. GetSelectedFolderURI()
// will return the message that is highlighted.
uriToOpen = GetSelectedFolderURI();
if (uriToOpen) {
// get the messenger window open service and ask it to open a new window for us
- var mailWindowService = Components.classes["@mozilla.org/messenger/windowservice;1"].getService(Components.interfaces.nsIMessengerWindowService);
+ var mailWindowService = Cc["@mozilla.org/messenger/windowservice;1"].getService(Ci.nsIMessengerWindowService);
if (mailWindowService)
mailWindowService.openMessengerWindowWithUri("mail:3pane", uriToOpen, keyToSelect);
}
}
function MsgOpenSelectedMessages()
{
// Toggle message body (rss summary) and content-base url in message
@@ -1870,22 +1870,22 @@ function MsgFilters(emailAddress, folder
{
args = { refresh: false, folder: folder };
MsgFilterList(args);
}
}
function MsgApplyFilters()
{
- var filterService = Components.classes["@mozilla.org/messenger/services/filters;1"]
- .getService(Components.interfaces.nsIMsgFilterService);
+ var filterService = Cc["@mozilla.org/messenger/services/filters;1"]
+ .getService(Ci.nsIMsgFilterService);
var preselectedFolder = GetFirstSelectedMsgFolder();
- var selectedFolders = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var selectedFolders = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
selectedFolders.appendElement(preselectedFolder);
var curFilterList = preselectedFolder.getFilterList(msgWindow);
// create a new filter list and copy over the enabled filters to it.
// We do this instead of having the filter after the fact code ignore
// disabled filters because the Filter Dialog filter after the fact
// code would have to clone filters to allow disabled filters to run,
// and we don't support cloning filters currently.
@@ -1895,52 +1895,52 @@ function MsgApplyFilters()
tempFilterList.logStream = curFilterList.logStream;
tempFilterList.loggingEnabled = curFilterList.loggingEnabled;
var newFilterIndex = 0;
for (var i = 0; i < numFilters; i++)
{
var curFilter = curFilterList.getFilterAt(i);
// only add enabled, UI visibile filters that are in the manual context
if (curFilter.enabled && !curFilter.temporary &&
- (curFilter.filterType & Components.interfaces.nsMsgFilterType.Manual))
+ (curFilter.filterType & Ci.nsMsgFilterType.Manual))
{
tempFilterList.insertFilterAt(newFilterIndex, curFilter);
newFilterIndex++;
}
}
filterService.applyFiltersToFolders(tempFilterList, selectedFolders, msgWindow);
}
function MsgApplyFiltersToSelection()
{
- var filterService = Components.classes["@mozilla.org/messenger/services/filters;1"]
- .getService(Components.interfaces.nsIMsgFilterService);
+ var filterService = Cc["@mozilla.org/messenger/services/filters;1"]
+ .getService(Ci.nsIMsgFilterService);
var folder = gDBView.msgFolder;
var indices = GetSelectedIndices(gDBView);
if (indices && indices.length)
{
- var selectedMsgs = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var selectedMsgs = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
for (var i = 0; i < indices.length; i++)
{
try
{
// Getting the URI will tell us if the item is real or a dummy header
var uri = gDBView.getURIForViewIndex(indices[i]);
if (uri)
{
var msgHdr = folder.GetMessageHeader(gDBView.getKeyAt(indices[i]));
if (msgHdr)
selectedMsgs.appendElement(msgHdr);
}
} catch (ex) {}
}
- filterService.applyFilters(Components.interfaces.nsMsgFilterType.Manual,
+ filterService.applyFilters(Ci.nsMsgFilterType.Manual,
selectedMsgs,
folder,
msgWindow);
}
}
function ChangeMailLayout(newLayout)
{
@@ -2083,22 +2083,22 @@ function PrintEnginePrintInternal(aDoPri
messageList.length, messageList, statusFeedback,
aDoPrintPreview, aMsgType);
return true;
}
function PrintEnginePrint()
{
- return PrintEnginePrintInternal(false, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINT_MSG);
+ return PrintEnginePrintInternal(false, Ci.nsIMsgPrintEngine.MNAB_PRINT_MSG);
}
function PrintEnginePrintPreview()
{
- return PrintEnginePrintInternal(true, Components.interfaces.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_MSG);
+ return PrintEnginePrintInternal(true, Ci.nsIMsgPrintEngine.MNAB_PRINTPREVIEW_MSG);
}
function IsMailFolderSelected()
{
var selectedFolders = GetSelectedMsgFolders();
var numFolders = selectedFolders.length;
if(numFolders !=1)
return false;
@@ -2137,17 +2137,17 @@ function IsGetNextNMessagesEnabled()
if (!folder)
return false;
var server = folder.server;
var serverType = server.type;
var menuItem = document.getElementById("menu_getnextnmsg");
if ((serverType == "nntp") && !folder.isServer) {
- var newsServer = server.QueryInterface(Components.interfaces.nsINntpIncomingServer);
+ var newsServer = server.QueryInterface(Ci.nsINntpIncomingServer);
var menuLabel = PluralForm.get(newsServer.maxArticles,
gMessengerBundle.getString("getNextNewsMessages"))
.replace("#1", newsServer.maxArticles);
menuItem.setAttribute("label",menuLabel);
menuItem.removeAttribute("hidden");
return true;
}
@@ -2381,25 +2381,25 @@ function GetFolderMessages()
var folders = new Array(1);
folders[0] = folder;
GetNewMessages(folders, folder.server);
}
function SendUnsentMessages()
{
- var msgSendlater = Components.classes["@mozilla.org/messengercompose/sendlater;1"]
- .getService(Components.interfaces.nsIMsgSendLater);
+ var msgSendlater = Cc["@mozilla.org/messengercompose/sendlater;1"]
+ .getService(Ci.nsIMsgSendLater);
var identitiesCount, allIdentities, currentIdentity, numMessages, msgFolder;
if (accountManager) {
allIdentities = accountManager.allIdentities;
identitiesCount = allIdentities.length;
for (var i = 0; i < identitiesCount; i++) {
- currentIdentity = allIdentities.queryElementAt(i, Components.interfaces.nsIMsgIdentity);
+ currentIdentity = allIdentities.queryElementAt(i, Ci.nsIMsgIdentity);
msgFolder = msgSendlater.getUnsentMessagesFolder(currentIdentity);
if(msgFolder) {
numMessages = msgFolder.getTotalMessages(false /* include subfolders */);
if(numMessages > 0) {
msgSendlater.statusFeedback = statusFeedback;
msgSendlater.sendUnsentMessages(currentIdentity);
// right now, all identities point to the same unsent messages
// folder, so to avoid sending multiple copies of the
@@ -2453,17 +2453,17 @@ function SetupUndoRedoCommand(command)
else
{
canUndoOrRedo = messenger.canRedo();
txnType = messenger.getRedoTransactionType();
}
if (canUndoOrRedo)
{
- const nsIMessenger = Components.interfaces.nsIMessenger;
+ const nsIMessenger = Ci.nsIMessenger;
switch (txnType)
{
default:
case nsIMessenger.eUnknown:
goSetMenuValue(command, 'valueDefault');
break;
case nsIMessenger.eDeleteMsg:
goSetMenuValue(command, 'valueDeleteMsg');
@@ -2519,19 +2519,19 @@ function HandleJunkStatusChanged(folder)
// If the current row isn't going to change, reload to show sanitized or
// unsanitized. Otherwise we wouldn't see the reloaded version anyway.
// XXX: need to special handle last message in view, for imap mark as deleted
// 1) When marking as non-junk, the msg would move back to the inbox.
// 2) When marking as junk, the msg will move or delete, if manualMark is set.
// 3) Marking as junk in the junk folder just changes the junk status.
- if ((!isJunk && folder.isSpecialFolder(Components.interfaces.nsMsgFolderFlags.Inbox)) ||
+ if ((!isJunk && folder.isSpecialFolder(Ci.nsMsgFolderFlags.Inbox)) ||
(isJunk && !folder.server.spamSettings.manualMark) ||
- (isJunk && folder.isSpecialFolder(Components.interfaces.nsMsgFolderFlags.Junk)))
+ (isJunk && folder.isSpecialFolder(Ci.nsMsgFolderFlags.Junk)))
ReloadMessage();
}
}
}
var gMessageNotificationBar =
{
get mStringBundle()
@@ -2861,18 +2861,18 @@ function checkMsgHdrPropertyIsNot(aPrope
/**
* Mark a specified message as read.
* @param msgHdr header (nsIMsgDBHdr) of the message to mark as read
*/
function MarkMessageAsRead(msgHdr)
{
ClearPendingReadTimer();
- var headers = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var headers = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
headers.appendElement(msgHdr);
msgHdr.folder.markMessagesRead(headers, true);
}
function ClearPendingReadTimer()
{
if (gMarkViewedMessageAsReadTimer)
{
@@ -3007,28 +3007,28 @@ function HandleMDNResponse(aUrl)
{
var mimeMsgId = mimeHdr.extractHeader("Message-Id", false);
if (mimeMsgId)
msgHdr.messageId = mimeMsgId;
}
// After a msg is downloaded it's already marked READ at this point so we must check if
// the msg has a "Disposition-Notification-To" header and no MDN report has been sent yet.
- if (msgHdr.flags & Components.interfaces.nsMsgMessageFlags.MDNReportSent)
+ if (msgHdr.flags & Ci.nsMsgMessageFlags.MDNReportSent)
return;
var DNTHeader = mimeHdr.extractHeader("Disposition-Notification-To", false);
var oldDNTHeader = mimeHdr.extractHeader("Return-Receipt-To", false);
if (!DNTHeader && !oldDNTHeader)
return;
// Everything looks good so far, let's generate the MDN response.
- var mdnGenerator = Components.classes["@mozilla.org/messenger-mdn/generator;1"]
- .createInstance(Components.interfaces.nsIMsgMdnGenerator);
- var askUser = mdnGenerator.process(Components.interfaces.nsIMsgMdnGenerator.eDisplayed,
+ var mdnGenerator = Cc["@mozilla.org/messenger-mdn/generator;1"]
+ .createInstance(Ci.nsIMsgMdnGenerator);
+ var askUser = mdnGenerator.process(Ci.nsIMsgMdnGenerator.eDisplayed,
msgWindow,
msgFolder,
msgHdr.messageKey,
mimeHdr,
false);
if (askUser)
gMessageNotificationBar.setMDNMsg(mdnGenerator, msgHdr, mimeHdr);
}
@@ -3057,18 +3057,18 @@ function MsgJunkMailInfo(aCheckFirstUse)
{
if (aCheckFirstUse) {
if (!Services.prefs.getBoolPref("mailnews.ui.junk.firstuse"))
return;
Services.prefs.setBoolPref("mailnews.ui.junk.firstuse", false);
// check to see if this is an existing profile where the user has started using
// the junk mail feature already
- var junkmailPlugin = Components.classes["@mozilla.org/messenger/filter-plugin;1?name=bayesianfilter"]
- .getService(Components.interfaces.nsIJunkMailPlugin);
+ var junkmailPlugin = Cc["@mozilla.org/messenger/filter-plugin;1?name=bayesianfilter"]
+ .getService(Ci.nsIJunkMailPlugin);
if (junkmailPlugin.userHasClassified)
return;
}
var desiredWindow = Services.wm.getMostRecentWindow("mailnews:junkmailinfo");
if (desiredWindow)
desiredWindow.focus();
@@ -3181,17 +3181,17 @@ function FeedSetContentView(val)
gFolderDisplay.displayedFolder.URI,
FeedUtils.FZ_QUICKMODE,
gFolderDisplay.displayedFolder.server);
}
catch (ex) {};
if (targetRes)
{
- quickMode = targetRes.QueryInterface(Components.interfaces
+ quickMode = targetRes.QueryInterface(Ci
.nsIRDFLiteral);
quickMode = quickMode.Value;
quickMode = eval(quickMode);
}
else
// Do not have this item's feed anymore in feeds.rdf though its
// message folder remains and its items exist in feeditems.rdf
// (Bug 309449), or the item has been moved to another folder,
--- a/suite/mailnews/messageWindow.js
+++ b/suite/mailnews/messageWindow.js
@@ -24,17 +24,17 @@ var gNextMessageAfterLoad = null;
var folderListener = {
OnItemAdded: function(parentItem, item) {},
OnItemRemoved: function(parentItem, item)
{
if (parentItem.URI != gCurrentFolderUri)
return;
- if (item instanceof Components.interfaces.nsIMsgDBHdr &&
+ if (item instanceof Ci.nsIMsgDBHdr &&
extractMsgKeyFromURI() == item.messageKey)
gCurrentMessageIsDeleted = true;
},
OnItemPropertyChanged: function(item, property, oldValue, newValue) {},
OnItemIntPropertyChanged: function(item, property, oldValue, newValue) {
if (item.URI == gCurrentFolderUri) {
if (property == "TotalMessages" || property == "TotalUnreadMessages") {
@@ -159,21 +159,21 @@ nsMsgDBViewCommandUpdater.prototype =
{
SetNextMessageAfterDelete();
},
summarizeSelection: function() {return false},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIMsgDBViewCommandUpdater) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIMsgDBViewCommandUpdater) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
}
function HandleDeleteOrMoveMsgCompleted(folder)
{
if ((folder.URI == gCurrentFolderUri) && gCurrentMessageIsDeleted)
{
gDBView.onDeleteCompleted(true);
@@ -216,17 +216,17 @@ function OnLoadMessageWindow()
InitMsgWindow();
messenger.setWindow(window, msgWindow);
AddDataSources();
// FIX ME - later we will be able to use onload from the overlay
OnLoadMsgHeaderPane();
try {
- var nsIFolderListener = Components.interfaces.nsIFolderListener;
+ var nsIFolderListener = Ci.nsIFolderListener;
var notifyFlags = nsIFolderListener.removed | nsIFolderListener.event | nsIFolderListener.intPropertyChanged;
mailSession.AddFolderListener(folderListener, notifyFlags);
} catch (ex) {
dump("Error adding to session: " +ex + "\n");
}
var originalView = null;
var folder = null;
@@ -234,21 +234,21 @@ function OnLoadMessageWindow()
var loadCustomMessage = false; //set to true when either loading a message/rfc822 attachment or a .eml file
if (window.arguments)
{
if (window.arguments[0])
{
try
{
messageUri = window.arguments[0];
- if (messageUri instanceof Components.interfaces.nsIURI)
+ if (messageUri instanceof Ci.nsIURI)
{
loadCustomMessage = /type=application\/x-message-display/.test(messageUri.spec);
gCurrentMessageUri = messageUri.spec;
- if (messageUri instanceof Components.interfaces.nsIMsgMailNewsUrl)
+ if (messageUri instanceof Ci.nsIMsgMailNewsUrl)
folder = messageUri.folder;
}
}
catch(ex)
{
folder = null;
dump("## ex=" + ex + "\n");
}
--- a/suite/mailnews/messengerdnd.js
+++ b/suite/mailnews/messengerdnd.js
@@ -1,36 +1,36 @@
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// cache these services
-var nsIDragService = Components.interfaces.nsIDragService;
-var dragService = Components.classes["@mozilla.org/widget/dragservice;1"]
- .getService(nsIDragService);
+var nsIDragService = Ci.nsIDragService;
+var dragService = Cc["@mozilla.org/widget/dragservice;1"]
+ .getService(nsIDragService);
function CanDropOnFolderTree(aIndex, aOrientation)
{
var dragSession = dragService.getCurrentSession();
if (!dragSession)
return false;
var folderTree = GetFolderTree();
var targetFolder = GetFolderResource(folderTree, aIndex)
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
var dt = dragSession.dataTransfer;
var count = dt.mozItemCount;
// We only support drag of a single flavor at a time.
var types = Array.from(dt.mozTypesAt(0));
if (types.includes("text/x-moz-message"))
{
// Only allow dragging onto container.
- if (aOrientation != Components.interfaces.nsITreeView.DROP_ON)
+ if (aOrientation != Ci.nsITreeView.DROP_ON)
return false;
// Don't allow drop onto server itself.
if (targetFolder.isServer)
return false;
// Don't allow drop into a folder that cannot take messages.
if (!targetFolder.canFileMessages)
return false;
for (let i = 0; i < count; i++)
@@ -40,135 +40,135 @@ function CanDropOnFolderTree(aIndex, aOr
if (msgHdr.folder == targetFolder)
return false;
}
return true;
}
else if (types.includes("text/x-moz-folder"))
{
// Only allow dragging onto container.
- if (aOrientation != Components.interfaces.nsITreeView.DROP_ON)
+ if (aOrientation != Ci.nsITreeView.DROP_ON)
return false;
// If cannot create subfolders then don't allow drop here.
if (!targetFolder.canCreateSubfolders)
return false;
for (let i = 0; i < count; i++)
{
let folder = dt.mozGetDataAt("text/x-moz-folder", i)
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
// Don't allow to drop on itself.
if (targetFolder == folder)
return false;
// Don't copy within same server.
if (folder.server == targetFolder.server && dt.dropEffect == "copy")
return false;
// Don't allow immediate child to be dropped onto its parent.
if (targetFolder == folder.parent)
return false;
// Don't allow dragging of virtual folders across accounts.
- if ((folder.flags & Components.interfaces.nsMsgFolderFlags.Virtual) &&
+ if ((folder.flags & Ci.nsMsgFolderFlags.Virtual) &&
folder.server != targetFolder.server)
return false;
// Don't allow parent to be dropped on its ancestors.
if (folder.isAncestorOf(targetFolder))
return false;
// If there is a folder that can't be renamed, don't allow it to be
// dropped if it is not to "Local Folders" or is to the same account.
if (!folder.canRename && (targetFolder.server.type != "none" ||
folder.server == targetFolder.server))
return false;
}
return true;
}
else if (types.includes("text/x-moz-newsfolder"))
{
// Don't allow dragging onto newsgroup.
- if (aOrientation == Components.interfaces.nsITreeView.DROP_ON)
+ if (aOrientation == Ci.nsITreeView.DROP_ON)
return false;
// Don't allow drop onto server itself.
if (targetFolder.isServer)
return false;
for (let i = 0; i < count; i++)
{
let folder = dt.mozGetDataAt("text/x-moz-newsfolder", i)
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
// Don't allow dragging newsgroup to other account.
if (targetFolder.rootFolder != folder.rootFolder)
return false;
// Don't allow dragging newsgroup to before/after itself.
if (targetFolder == folder)
return false;
// Don't allow dragging newsgroup to before item after or
// after item before.
aIndex += aOrientation;
if (aIndex < folderTree.view.rowCount) {
targetFolder = GetFolderResource(folderTree, aIndex)
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
if (targetFolder == folder)
return false;
}
}
return true;
}
else if (types.includes("text/x-moz-url"))
{
// Only allow dragging onto container.
- if (aOrientation != Components.interfaces.nsITreeView.DROP_ON)
+ if (aOrientation != Ci.nsITreeView.DROP_ON)
return false;
// This is a potential RSS feed to subscribe to
// and there's only one, so just get the 0th element.
let url = dt.mozGetDataAt("text/x-moz-url", 0);
let scheme = Services.io.extractScheme(url);
if (/^https?$/.test(scheme) && targetFolder.server.type == "rss")
return true;
}
else if (types.includes("application/x-moz-file"))
{
// Only allow dragging onto container.
- if (aOrientation != Components.interfaces.nsITreeView.DROP_ON)
+ if (aOrientation != Ci.nsITreeView.DROP_ON)
return false;
// Don't allow drop onto server itself.
if (targetFolder.isServer)
return false;
// Don't allow drop into a folder that cannot take messages.
if (!targetFolder.canFileMessages)
return false;
let extFile = dt.mozGetDataAt("application/x-moz-file", 0);
- if (extFile instanceof Components.interfaces.nsIFile)
+ if (extFile instanceof Ci.nsIFile)
return extFile.isFile();
}
return false;
}
function DropOnFolderTree(aRow, aOrientation)
{
var dragSession = dragService.getCurrentSession();
if (!dragSession)
return;
var folderTree = GetFolderTree();
var targetFolder = GetFolderResource(folderTree, aRow)
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
var dt = dragSession.dataTransfer;
var count = dt.mozItemCount;
// We only support drag of a single flavor at a time.
var types = Array.from(dt.mozTypesAt(0));
if (types.includes("text/x-moz-folder"))
{
const NS_MSG_FOLDER_EXISTS = 0x80550013;
const NS_MSG_ERROR_COPY_FOLDER_ABORTED = 0x8055001a;
for (let i = 0; i < count; i++)
{
let folder = dt.mozGetDataAt("text/x-moz-folder", i);
- let array = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let array = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
array.appendElement(folder);
try
{
gCopyService.CopyFolders(array,
targetFolder,
(folder.server == targetFolder.server),
null,
msgWindow);
@@ -183,22 +183,22 @@ function DropOnFolderTree(aRow, aOrienta
}
}
else if (types.includes("text/x-moz-newsfolder"))
{
// Start by getting folders into order.
let folders = new Array;
for (let i = 0; i < count; i++) {
let folder = dt.mozGetDataAt("text/x-moz-newsfolder", i)
- .QueryInterface(Components.interfaces.nsIMsgFolder);
+ .QueryInterface(Ci.nsIMsgFolder);
let folderIndex = EnsureFolderIndex(folderTree.builderView, folder);
folders[folderIndex] = folder;
}
let newsFolder = targetFolder.rootFolder
- .QueryInterface(Components.interfaces.nsIMsgNewsFolder);
+ .QueryInterface(Ci.nsIMsgNewsFolder);
// When moving down, want to insert last one first.
// When moving up, want to insert first one first.
let i = (aOrientation == 1) ? folders.length - 1 : 0;
while (i >= 0 && i < folders.length) {
let folder = folders[i];
if (folder) {
newsFolder.moveFolder(folder, targetFolder, aOrientation);
@@ -206,18 +206,18 @@ function DropOnFolderTree(aRow, aOrienta
folderTree.view.selection.toggleSelect(folderIndex);
folderTree.treeBoxObject.ensureRowIsVisible(folderIndex);
}
i -= aOrientation;
}
}
else if (types.includes("text/x-moz-message"))
{
- let array = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let array = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
let sourceFolder;
for (let i = 0; i < count; i++)
{
let msgHdr = messenger.msgHdrFromURI(dt.mozGetDataAt("text/x-moz-message", i));
if (!sourceFolder)
sourceFolder = msgHdr.folder;
array.appendElement(msgHdr);
}
@@ -232,30 +232,30 @@ function DropOnFolderTree(aRow, aOrienta
gCopyService.CopyMessages(sourceFolder, array, targetFolder, isMove, null,
msgWindow, true);
}
else if (types.includes("application/x-moz-file"))
{
for (let i = 0; i < count; i++)
{
let extFile = dt.mozGetDataAt("application/x-moz-file", i)
- .QueryInterface(Components.interfaces.nsIFile);
+ .QueryInterface(Ci.nsIFile);
if (extFile.isFile() && /\.eml$/i.test(extFile.leafName))
gCopyService.CopyFileMessage(extFile, targetFolder, null, false, 1,
"", null, msgWindow);
}
}
else if (types.includes("text/x-moz-url"))
{
// This is a potential RSS feed to subscribe to
// and there's only one, so just get the 0th element.
let url = dt.mozGetDataAt("text/x-moz-url", 0);
- Components.classes["@mozilla.org/newsblog-feed-downloader;1"]
- .getService(Components.interfaces.nsINewsBlogFeedDownloader)
- .subscribeToFeed(url, targetFolder, msgWindow);
+ Cc["@mozilla.org/newsblog-feed-downloader;1"]
+ .getService(Ci.nsINewsBlogFeedDownloader)
+ .subscribeToFeed(url, targetFolder, msgWindow);
}
}
function BeginDragFolderTree(aEvent)
{
if (aEvent.originalTarget.localName != "treechildren")
return false;
@@ -319,30 +319,30 @@ function DragOverThreadPane(aEvent)
return;
let dt = aEvent.dataTransfer;
dt.effectAllowed = "copy";
for (let i = 0; i < dt.mozItemCount; i++)
{
if (Array.from(dt.mozTypesAt(i)).includes("application/x-moz-file"))
{
let extFile = dt.mozGetDataAt("application/x-moz-file", i)
- .QueryInterface(Components.interfaces.nsIFile);
+ .QueryInterface(Ci.nsIFile);
if (extFile.isFile() && /\.eml$/i.test(extFile.leafName))
{
aEvent.preventDefault();
return;
}
}
}
}
function DropOnThreadPane(aEvent)
{
let dt = aEvent.dataTransfer;
for (let i = 0; i < dt.mozItemCount; i++)
{
let extFile = dt.mozGetDataAt("application/x-moz-file", i)
- .QueryInterface(Components.interfaces.nsIFile);
+ .QueryInterface(Ci.nsIFile);
if (extFile.isFile() && /\.eml$/i.test(extFile.leafName))
gCopyService.CopyFileMessage(extFile, gMsgFolderSelected, null, false, 1,
"", null, msgWindow);
}
}
--- a/suite/mailnews/msgHdrViewOverlay.js
+++ b/suite/mailnews/msgHdrViewOverlay.js
@@ -37,18 +37,18 @@ var gMessengerBundle;
// Globals for setFromBuddyIcon().
var gFileHandler;
var gProfileDirURL;
var gExtraExpandedHeaders;
// Show the friendly display names for people I know, instead of the name + email address.
var gShowCondensedEmailAddresses;
-var msgHeaderParser = Components.classes["@mozilla.org/messenger/headerparser;1"]
- .getService(Components.interfaces.nsIMsgHeaderParser);
+var msgHeaderParser = Cc["@mozilla.org/messenger/headerparser;1"]
+ .getService(Ci.nsIMsgHeaderParser);
var abAddressCollector = null;
// other components may listen to on start header & on end header notifications for each message we display
// to do that you need to add yourself to our gMessageListeners array with an object that supports the three properties:
// onStartHeaders, onEndHeaders and onEndAttachments.
var gMessageListeners = new Array();
// For every possible "view" in the message pane, you need to define the header names you want to
@@ -112,19 +112,19 @@ var currentHeaderData = {};
// view, it's up to the view layer to extract this attachment data and turn it into something useful.
// For a given entry in the attachments list, you can ask for the following properties:
// .contentType --> the content type of the attachment
// url --> an imap, or mailbox url which can be used to fetch the message
// uri --> an RDF URI which refers to the message containig the attachment
// isExternalAttachment --> boolean flag stating whether the attachment is external or not.
var currentAttachments = new Array();
-const nsIAbDirectory = Components.interfaces.nsIAbDirectory;
-const nsIAbListener = Components.interfaces.nsIAbListener;
-const nsIAbCard = Components.interfaces.nsIAbCard;
+const nsIAbDirectory = Ci.nsIAbDirectory;
+const nsIAbListener = Ci.nsIAbListener;
+const nsIAbCard = Ci.nsIAbCard;
// createHeaderEntry --> our constructor method which creates a header Entry
// based on an entry in one of the header lists. A header entry is different from a header list.
// a header list just describes how you want a particular header to be presented. The header entry
// actually has knowledge about the DOM and the actual DOM elements associated with the header.
// prefix --> the name of the view (i.e. "collapsed", "expanded")
// headerListInfo --> entry from a header list.
function createHeaderEntry(prefix, headerListInfo)
@@ -232,37 +232,37 @@ function OnLoadMsgHeaderPane()
gExtraExpandedHeaders = Services.prefs.getCharPref("mailnews.headers.extraExpandedHeaders");
Services.prefs.addObserver("mail.showCondensedAddresses", MsgHdrViewObserver);
initializeHeaderViewTables();
// Add an address book listener so we can update the header view when things
// change.
- Components.classes["@mozilla.org/abmanager;1"]
- .getService(Components.interfaces.nsIAbManager)
- .addAddressBookListener(AddressBookListener, nsIAbListener.all);
+ Cc["@mozilla.org/abmanager;1"]
+ .getService(Ci.nsIAbManager)
+ .addAddressBookListener(AddressBookListener, nsIAbListener.all);
var toggleHeaderView = GetHeaderPane();
var initialCollapsedSetting = toggleHeaderView.getAttribute("state");
if (initialCollapsedSetting == "true")
gCollapsedHeaderViewMode = true;
// dispatch an event letting any listeners know that we have loaded the message pane
toggleHeaderView.dispatchEvent(new Event('messagepane-loaded',
{ bubbles: false, cancelable: true }));
}
function OnUnloadMsgHeaderPane()
{
Services.prefs.removeObserver("mail.showCondensedAddresses", MsgHdrViewObserver);
- Components.classes["@mozilla.org/abmanager;1"]
- .getService(Components.interfaces.nsIAbManager)
- .removeAddressBookListener(AddressBookListener);
+ Cc["@mozilla.org/abmanager;1"]
+ .getService(Ci.nsIAbManager)
+ .removeAddressBookListener(AddressBookListener);
// dispatch an event letting any listeners know that we have unloaded the message pane
GetHeaderPane().dispatchEvent(new Event('messagepane-unloaded',
{ bubbles: false, cancelable: true }));
}
var MsgHdrViewObserver =
{
@@ -327,17 +327,17 @@ function OnAddressBookDataChanged(aActio
});
}
// The messageHeaderSink is the class that gets notified of a message's headers as we display the message
// through our mime converter.
var messageHeaderSink = {
QueryInterface: XPCOMUtils.generateQI(
- [Components.interfaces.nsIMsgHeaderSink]),
+ [Ci.nsIMsgHeaderSink]),
onStartHeaders: function()
{
this.mSaveHdr = null;
// clear out any pending collected address timers...
if (gCollectAddressTimer)
{
clearTimeout(gCollectAddressTimer);
gCollectAddressTimer = null;
@@ -591,17 +591,17 @@ var messageHeaderSink = {
}
},
onEndMsgDownload: function(url)
{
// if we don't have any attachments, turn off the attachments flag
if (!this.mSaveHdr)
{
- var messageUrl = url.QueryInterface(Components.interfaces.nsIMsgMessageUrl);
+ var messageUrl = url.QueryInterface(Ci.nsIMsgMessageUrl);
try
{
this.mSaveHdr = messenger.msgHdrFromURI(messageUrl.uri);
}
catch (ex) {}
}
if (!currentAttachments.length && this.mSaveHdr)
@@ -637,18 +637,18 @@ var messageHeaderSink = {
if (!this.mDummyMsgHeader)
this.mDummyMsgHeader = new nsDummyMsgHeader();
return this.mDummyMsgHeader;
},
mProperties: null,
get properties()
{
if (!this.mProperties)
- this.mProperties = Components.classes["@mozilla.org/hash-property-bag;1"].
- createInstance(Components.interfaces.nsIWritablePropertyBag2);
+ this.mProperties = Cc["@mozilla.org/hash-property-bag;1"].
+ createInstance(Ci.nsIWritablePropertyBag2);
return this.mProperties;
},
resetProperties: function()
{
this.mProperties = null;
}
};
@@ -664,18 +664,18 @@ function SetTagHeader()
msgHdr = gDBView.hdrForFirstSelectedMessage;
}
catch (ex)
{
return; // no msgHdr to add our tags to
}
// get the list of known tags
- var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
- .getService(Components.interfaces.nsIMsgTagService);
+ var tagService = Cc["@mozilla.org/messenger/tagservice;1"]
+ .getService(Ci.nsIMsgTagService);
var tagArray = tagService.getAllTags({});
var tagKeys = {};
for (var tagInfo of tagArray)
if (tagInfo.tag)
tagKeys[tagInfo.key] = true;
// extract the tag keys from the msgHdr
var msgKeyArray = msgHdr.getStringProperty("keywords").split(" ");
@@ -713,19 +713,19 @@ function EnsureSubjectValue()
currentHeaderData[foo.headerName] = foo;
}
}
// Private method used by messageHeaderSink::processHeaders.
function collectAddresses(aAddresses, aCreateCard)
{
if (!abAddressCollector)
- abAddressCollector = Components.classes["@mozilla.org/addressbook/services/addressCollector;1"]
- .getService(Components.interfaces.nsIAbAddressCollector);
- var sendFormat = Components.interfaces.nsIAbPreferMailFormat.unknown;
+ abAddressCollector = Cc["@mozilla.org/addressbook/services/addressCollector;1"]
+ .getService(Ci.nsIAbAddressCollector);
+ var sendFormat = Ci.nsIAbPreferMailFormat.unknown;
abAddressCollector.collectAddress(aAddresses, aCreateCard, sendFormat);
}
// Public method called by the tag front end code when the tags for the selected
// message has changed.
function OnTagsChange()
{
// rebuild the tag headers
@@ -1120,17 +1120,17 @@ function setFromBuddyIcon(email)
// For now, retrieve the screen name only.
var iconURLStr = card.getProperty("_AimScreenName", "");
if (iconURLStr)
{
// Lazily create these globals.
if (!gFileHandler)
{
gFileHandler = Services.io.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
gProfileDirURL = Services.io.newFileURI(GetSpecialDirectory("ProfD"));
}
// If we did have a buddy icon on disk for this screenname,
// this would be the file url spec for it.
iconURLStr = gProfileDirURL.spec + "/NIM/" + myScreenName
+ "/picture/" + iconURLStr + ".gif";
@@ -1292,19 +1292,19 @@ function SetupEmailAddressPopup(aAddress
* properties will be null.
*
* @param emailAddress The email address to find.
* @return An object with two properties, book and card.
* @see nsIAbDirectory.cardForEmailAddress()
*/
function GetCardForEmail(aEmailAddress)
{
- var books = Components.classes["@mozilla.org/abmanager;1"]
- .getService(Components.interfaces.nsIAbManager)
- .directories;
+ var books = Cc["@mozilla.org/abmanager;1"]
+ .getService(Ci.nsIAbManager)
+ .directories;
var result = { book: null, card: null};
while (!result.card && books.hasMoreElements())
{
var ab = books.getNext();
if (ab instanceof nsIAbDirectory)
{
@@ -1389,18 +1389,18 @@ createNewAttachmentInfo.prototype.openAt
"_blank", "all,dialog=no",
Services.io.newURI(url));
return;
case "text/x-moz-deleted":
return;
}
var webNavigationInfo =
- Components.classes["@mozilla.org/webnavigation-info;1"]
- .getService(Components.interfaces.nsIWebNavigationInfo);
+ Cc["@mozilla.org/webnavigation-info;1"]
+ .getService(Ci.nsIWebNavigationInfo);
if (webNavigationInfo.isTypeSupported(this.contentType, null))
openAsExternal(this.url);
else
messenger.openAttachment(this.contentType,
this.url,
encodeURIComponent(this.displayName),
this.uri,
@@ -1806,17 +1806,17 @@ function ClearAttachmentList()
function ShowEditMessageBox()
{
try
{
// it would be nice if we passed in the msgHdr from the back end
var msgHdr = gDBView.hdrForFirstSelectedMessage;
if (!msgHdr || !msgHdr.folder)
return;
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
if (msgHdr.folder.isSpecialFolder(nsMsgFolderFlags.Drafts, true))
document.getElementById("editMessageBox").collapsed = false;
}
catch (ex) {}
}
function ClearEditMessageBox()
{
@@ -1829,18 +1829,18 @@ function ClearEditMessageBox()
// the website address we stored in there and copies it to the clipboard
function CopyWebsiteAddress(websiteAddressNode)
{
if (websiteAddressNode)
{
var websiteAddress = websiteAddressNode.getAttribute("value");
var contractid = "@mozilla.org/widget/clipboardhelper;1";
- var iid = Components.interfaces.nsIClipboardHelper;
- var clipboard = Components.classes[contractid].getService(iid);
+ var iid = Ci.nsIClipboardHelper;
+ var clipboard = Cc[contractid].getService(iid);
clipboard.copyString(websiteAddress);
}
}
function BookmarkWebsite(aWebsiteAddressNode)
{
if (aWebsiteAddressNode)
{
@@ -1876,52 +1876,52 @@ var attachmentAreaDNDObserver = {
data.addDataForFlavour("text/x-moz-url", info + "\n" +
attachment.displayName + "\n" + attachment.size);
data.addDataForFlavour("text/x-moz-url-data", attachment.url);
data.addDataForFlavour("text/x-moz-url-desc", attachment.displayName);
data.addDataForFlavour("application/x-moz-file-promise-url",
attachment.url);
data.addDataForFlavour("application/x-moz-file-promise",
new nsFlavorDataProvider(), 0,
- Components.interfaces.nsISupports);
+ Ci.nsISupports);
}
aAttachmentData.data = data;
}
}
};
function nsFlavorDataProvider()
{
}
nsFlavorDataProvider.prototype =
{
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIFlavorDataProvider) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIFlavorDataProvider) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
},
getFlavorData : function(aTransferable, aFlavor, aData, aDataLen)
{
// get the url for the attachment
if (aFlavor == "application/x-moz-file-promise")
{
var urlPrimitive = { };
var dataSize = { };
aTransferable.getTransferData("application/x-moz-file-promise-url", urlPrimitive, dataSize);
- var srcUrlPrimitive = urlPrimitive.value.QueryInterface(Components.interfaces.nsISupportsString);
+ var srcUrlPrimitive = urlPrimitive.value.QueryInterface(Ci.nsISupportsString);
// now get the destination file location from kFilePromiseDirectoryMime
var dirPrimitive = {};
aTransferable.getTransferData("application/x-moz-file-promise-dir", dirPrimitive, dataSize);
- var destDirectory = dirPrimitive.value.QueryInterface(Components.interfaces.nsIFile);
+ var destDirectory = dirPrimitive.value.QueryInterface(Ci.nsIFile);
// now save the attachment to the specified location
// XXX: we need more information than just the attachment url to save it, fortunately, we have an array
// of all the current attachments so we can cheat and scan through them
var attachment = null;
for (let index in currentAttachments)
{
@@ -1929,17 +1929,17 @@ nsFlavorDataProvider.prototype =
if (attachment.url == srcUrlPrimitive)
break;
}
// call our code for saving attachments
if (attachment)
{
var destFilePath = messenger.saveAttachmentToFolder(attachment.contentType, attachment.url, encodeURIComponent(attachment.displayName), attachment.uri, destDirectory);
- aData.value = destFilePath.QueryInterface(Components.interfaces.nsISupports);
+ aData.value = destFilePath.QueryInterface(Ci.nsISupports);
aDataLen.value = 4;
}
}
}
}
function nsDummyMsgHeader()
{
--- a/suite/mailnews/msgMail3PaneWindow.js
+++ b/suite/mailnews/msgMail3PaneWindow.js
@@ -123,23 +123,23 @@ var folderListener =
OnItemIntPropertyChanged: function(item, property, oldValue, newValue)
{
// handle the currently visible folder
if (item == gMsgFolderSelected)
{
if (property == "TotalMessages" || property == "TotalUnreadMessages")
{
UpdateStatusMessageCounts(gMsgFolderSelected);
- item = item.QueryInterface(Components.interfaces.nsIRDFResource);
+ item = item.QueryInterface(Ci.nsIRDFResource);
UpdateLocationBar(item);
}
}
// check folders shown in tabs
- if (item instanceof Components.interfaces.nsIMsgFolder)
+ if (item instanceof Ci.nsIMsgFolder)
{
// find corresponding tabinfos
// we may have the folder openened in more than one tab
let tabmail = GetTabMail();
for (let i = 0; i < tabmail.tabInfo.length; ++i)
{
// if we never switched away from the tab, we only have just one
let tabFolder = tabmail.tabInfo[i].msgSelectedFolder || gMsgFolderSelected;
@@ -150,19 +150,19 @@ var folderListener =
}
}
}
},
OnItemEvent: function(folder, event) {
if (event == "FolderLoaded") {
if (folder) {
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
var scrolled = false;
- var msgFolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
+ var msgFolder = folder.QueryInterface(Ci.nsIMsgFolder);
var uri = folder.URI;
var rerootingFolder = (uri == gCurrentFolderToReroot);
if (rerootingFolder) {
viewDebug("uri = gCurrentFolderToReroot, setting gQSViewIsDirty\n");
gQSViewIsDirty = true;
gCurrentFolderToReroot = null;
if (msgFolder) {
msgFolder.endFolderLoading();
@@ -258,27 +258,27 @@ var folderListener =
}
}
}
}
}
}
else if (event == "ImapHdrDownloaded") {
if (folder) {
- var imapFolder = folder.QueryInterface(Components.interfaces.nsIMsgImapMailFolder);
+ var imapFolder = folder.QueryInterface(Ci.nsIMsgImapMailFolder);
if (imapFolder) {
var hdrParser = imapFolder.hdrParser;
if (hdrParser) {
var msgHdr = hdrParser.GetNewMsgHdr();
if (msgHdr)
{
var hdrs = hdrParser.headers;
if (hdrs && hdrs.indexOf("X-attachment-size:") > 0) {
- msgHdr.OrFlags(Components.interfaces.nsMsgMessageFlags
- .Attachment);
+ msgHdr.OrFlags(Ci.nsMsgMessageFlags
+ .Attachment);
}
if (hdrs && hdrs.indexOf("X-image-size:") > 0) {
msgHdr.setStringProperty("imageSize", "1");
}
}
}
}
}
@@ -325,20 +325,20 @@ var folderObserver = {
return;
var folderResource = GetFolderResource(folderTree, index);
if (folderTree.view.getLevel(index) == 0)
{
// (Imap/Nntp/Pop) Account item.
- folderResource.QueryInterface(Components.interfaces.nsIMsgFolder)
+ folderResource.QueryInterface(Ci.nsIMsgFolder)
.server.performExpand(msgWindow);
}
- else if (folderResource instanceof Components.interfaces.nsIMsgImapMailFolder)
+ else if (folderResource instanceof Ci.nsIMsgImapMailFolder)
{
// Imap message folder item.
folderResource.performExpand(msgWindow);
}
},
onCycleHeader: function(colID, elt)
@@ -396,17 +396,17 @@ function HandleDeleteOrMoveMsgCompleted(
gDBView.onDeleteCompleted(true);
if (!IsCurrentLoadedFolder(folder)) {
// default value after delete/move/copy is over
gNextMessageViewIndexAfterDelete = -2;
return;
}
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView);
var treeSelection = treeView.selection;
if (gNextMessageViewIndexAfterDelete == -2) {
// a move or delete can cause our selection can change underneath us.
// this can happen when the user
// deletes message from the stand alone msg window
// or the search view, or another 3 pane
if (treeSelection.count == 0) {
@@ -526,37 +526,37 @@ function HandleCompactCompleted(folder)
}
}
function LoadCurrentlyDisplayedMessage()
{
var scrolled = (gCurrentlyDisplayedMessage != nsMsgViewIndex_None);
if (scrolled)
{
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView);
var treeSelection = treeView.selection;
treeSelection.select(gCurrentlyDisplayedMessage);
if (treeView)
treeView.selectionChanged();
EnsureRowInThreadTreeIsVisible(gCurrentlyDisplayedMessage);
SetFocusThreadPane();
gCurrentlyDisplayedMessage = nsMsgViewIndex_None; //reset
}
return scrolled;
}
function IsCurrentLoadedFolder(aFolder)
{
- let msgFolderUri = aFolder.QueryInterface(Components.interfaces.nsIMsgFolder)
+ let msgFolderUri = aFolder.QueryInterface(Ci.nsIMsgFolder)
.URI;
let currentLoadedFolder = GetThreadPaneFolder();
// If the currently loaded folder is virtual,
// check if aFolder is one of its searched folders.
- if (currentLoadedFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual)
+ if (currentLoadedFolder.flags & Ci.nsMsgFolderFlags.Virtual)
{
return currentLoadedFolder.msgDatabase.dBFolderInfo
.getCharProperty("searchFolderUri").split("|")
.indexOf(msgFolderUri) != -1;
}
// Is aFolder the currently loaded folder?
return currentLoadedFolder.URI == msgFolderUri;
@@ -725,18 +725,18 @@ function OnLoadMessenger()
// argument[2] --> optional email address; // Will come from aim; needs to show msgs from buddy's email address.
if ("arguments" in window)
{
var args = window.arguments;
// filter our any feed urls that came in as arguments to the new window...
if (args.length && /^feed:/i.test(args[0]))
{
var feedHandler =
- Components.classes["@mozilla.org/newsblog-feed-downloader;1"]
- .getService(Components.interfaces.nsINewsBlogFeedDownloader);
+ Cc["@mozilla.org/newsblog-feed-downloader;1"]
+ .getService(Ci.nsINewsBlogFeedDownloader);
if (feedHandler)
feedHandler.subscribeToFeed(args[0], null, msgWindow);
}
else
{
startFolderUri = (args.length > 0) ? args[0] : null;
}
gStartMsgKey = (args.length > 1) ? args[1] : nsMsgKey_None;
@@ -815,17 +815,17 @@ function OnUnloadMessenger()
UnloadPanes();
OnMailWindowUnload();
}
// we probably want to warn if more than one tab is closed
function MailWindowIsClosing(aCancelQuit, aTopic, aData)
{
if (aTopic == "quit-application-requested" &&
- aCancelQuit instanceof Components.interfaces.nsISupportsPRBool &&
+ aCancelQuit instanceof Ci.nsISupportsPRBool &&
aCancelQuit.data)
return false;
let reallyClose = true;
let numtabs = GetTabMail().tabInfo.length;
if (numtabs > 1)
{
let shouldPrompt = Services.prefs.getBoolPref("browser.tabs.warnOnClose");
@@ -895,17 +895,17 @@ function loadStartFolder(initialUri)
// Get the user pref to see if the login at startup is enabled for default account
isLoginAtStartUpEnabled = defaultServer.loginAtStartUp;
// Get Inbox only if login at startup is enabled.
if (isLoginAtStartUpEnabled)
{
//now find Inbox
var rootMsgFolder = defaultServer.rootMsgFolder;
- const kInboxFlag = Components.interfaces.nsMsgFolderFlags.Inbox;
+ const kInboxFlag = Ci.nsMsgFolderFlags.Inbox;
var inboxFolder = rootMsgFolder.getFolderWithFlags(kInboxFlag);
if (inboxFolder)
initialUri = inboxFolder.URI;
}
}
SelectFolder(initialUri);
@@ -949,19 +949,19 @@ function loadStartFolder(initialUri)
else if(sendUnsentWhenGoingOnlinePref == 1) // pref is "yes"
SendUnsentMessages();
}
}
function AddToSession()
{
try {
- var mailSession = Components.classes["@mozilla.org/messenger/services/session;1"]
- .getService(Components.interfaces.nsIMsgMailSession);
- var nsIFolderListener = Components.interfaces.nsIFolderListener;
+ var mailSession = Cc["@mozilla.org/messenger/services/session;1"]
+ .getService(Ci.nsIMsgMailSession);
+ var nsIFolderListener = Ci.nsIFolderListener;
var notifyFlags = nsIFolderListener.intPropertyChanged | nsIFolderListener.event;
mailSession.AddFolderListener(folderListener, notifyFlags);
} catch (ex) {
dump("Error adding to session\n");
}
}
function InitPanes()
@@ -1015,17 +1015,17 @@ function OnLoadFolderPane()
//Add folderDataSource and accountManagerDataSource to folderPane
var database = GetFolderDatasource();
database.AddDataSource(accountManagerDataSource);
database.AddDataSource(folderDataSource);
var folderTree = GetFolderTree();
folderTree.setAttribute("ref", "msgaccounts:/");
- var folderTreeBuilder = folderTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder);
+ var folderTreeBuilder = folderTree.builder.QueryInterface(Ci.nsIXULTreeBuilder);
folderTreeBuilder.addObserver(folderObserver);
folderTree.addEventListener("click",FolderPaneOnClick,true);
folderTree.addEventListener("mousedown",TreeOnMouseDown,true);
}
function OnLoadThreadPane()
{
AddMutationObserver(UpdateAttachmentCol);
@@ -1058,26 +1058,26 @@ function OnLocationTreeSelect(menulist)
function UpdateLocationBar(resource)
{
var tree = GetFolderTree();
var folders = document.getElementById('locationFolders');
var icon = document.getElementById('locationIcon');
var names = ['BiffState', 'NewMessages', 'HasUnreadMessages',
'SpecialFolder', 'IsServer', 'IsSecure', 'ServerType', 'NoSelect'];
- let folder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
+ let folder = resource.QueryInterface(Ci.nsIMsgFolder);
folders.setAttribute("label", folder.prettyName);
- const rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"]
- .getService(Components.interfaces.nsIRDFService);
+ const rdfService = Cc["@mozilla.org/rdf/rdf-service;1"]
+ .getService(Ci.nsIRDFService);
function GetFolderAttribute(tree, source, attribute) {
let property = rdfService.GetResource("http://home.netscape.com/NC-rdf#" + attribute);
let target = tree.database.GetTarget(source, property, true);
if (target)
- target = target.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
+ target = target.QueryInterface(Ci.nsIRDFLiteral).Value;
return target;
}
for (var i in names) {
var name = names[i];
var value = GetFolderAttribute(tree, resource, name);
folders.setAttribute(name, value);
icon.setAttribute(name, value);
}
@@ -1138,17 +1138,17 @@ function GetTotalCountElement()
gTotalCount = document.getElementById('totalMessageCount');
return gTotalCount;
}
function ClearThreadPaneSelection()
{
try {
if (gDBView) {
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView);
var treeSelection = treeView.selection;
if (treeSelection)
treeSelection.clearSelection();
}
}
catch (ex) {
dump("ClearThreadPaneSelection: ex = " + ex + "\n");
}
@@ -1294,17 +1294,17 @@ function GetSelectedMsgFolders()
for (let i = 0; i < rangeCount; i++)
{
var startIndex = {};
var endIndex = {};
folderTree.view.selection.getRangeAt(i, startIndex, endIndex);
for (var j = startIndex.value; j <= endIndex.value; j++)
{
var folderResource = GetFolderResource(folderTree, j);
- let msgFolder = folderResource.QueryInterface(Components.interfaces.nsIMsgFolder);
+ let msgFolder = folderResource.QueryInterface(Ci.nsIMsgFolder);
folderArray.push(msgFolder);
}
}
return folderArray;
}
function GetSelectedIndices(dbView)
--- a/suite/mailnews/msgViewNavigation.js
+++ b/suite/mailnews/msgViewNavigation.js
@@ -12,17 +12,17 @@ ChromeUtils.import("resource:///modules/
function GetSubFoldersInFolderPaneOrder(folder)
{
var subFolders = folder.subFolders;
var msgFolders = Array();
// get all the subfolders
while (subFolders.hasMoreElements()) {
msgFolders[msgFolders.length] =
- subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
+ subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
}
function compareFolderSortKey(folder1, folder2) {
return folder1.compareSortKeys(folder2);
}
// sort the subfolders
msgFolders.sort(compareFolderSortKey);
@@ -39,17 +39,17 @@ function FindNextChildFolder(aParent, aA
var subFolders = GetSubFoldersInFolderPaneOrder(aParent);
var i = 0;
var folder = null;
// Skip folders until after the specified child
while (folder != aAfter)
folder = subFolders[i++];
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
let ignoreFlags = nsMsgFolderFlags.Trash | nsMsgFolderFlags.SentMail |
nsMsgFolderFlags.Drafts | nsMsgFolderFlags.Queue |
nsMsgFolderFlags.Templates | nsMsgFolderFlags.Junk;
while (i < subFolders.length) {
folder = subFolders[i++];
// if there is unread mail in the trash, sent, drafts, unsent messages
// templates or junk special folder,
// we ignore it when doing cross folder "next" navigation
@@ -189,37 +189,37 @@ function CrossFolderNavigation(type)
SelectFolder(folderUri);
}
}
function ScrollToMessage(type, wrap, selectMessage)
{
try {
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView);
var treeSelection = treeView.selection;
var currentIndex = treeSelection.currentIndex;
var resultId = new Object;
var resultIndex = new Object;
var threadIndex = new Object;
- let elidedFlag = Components.interfaces.nsMsgMessageFlags.Elided;
+ let elidedFlag = Ci.nsMsgMessageFlags.Elided;
let summarizeSelection =
Services.prefs.getBoolPref("mail.operate_on_msgs_in_collapsed_threads");
// if we're doing next unread, and a collapsed thread is selected, and
// the top level message is unread, just set the result manually to
// the top level message, without using gDBView.viewNavigate.
if (summarizeSelection && type == nsMsgNavigationType.nextUnreadMessage &&
currentIndex != -1 &&
gDBView.getFlagsAt(currentIndex) & elidedFlag &&
gDBView.isContainer(currentIndex) &&
! (gDBView.getFlagsAt(currentIndex) &
- Components.interfaces.nsMsgMessageFlags.Read)) {
+ Ci.nsMsgMessageFlags.Read)) {
resultIndex.value = currentIndex;
resultId.value = gDBView.getKeyAt(currentIndex);
} else {
gDBView.viewNavigate(type, resultId, resultIndex, threadIndex, true /* wrap */);
}
// only scroll and select if we found something
if ((resultId.value != nsMsgViewIndex_None) && (resultIndex.value != nsMsgViewIndex_None)) {
--- a/suite/mailnews/msgViewPickerOverlay.js
+++ b/suite/mailnews/msgViewPickerOverlay.js
@@ -17,19 +17,19 @@ const kViewCurrent = "current-view";
const kViewCurrentTag = "current-view-tag";
const kViewTagMarker = ":";
var gMailViewList = null;
var gCurrentViewValue = kViewItemAll;
var gCurrentViewLabel = "";
var gSaveDefaultSVTerms;
-var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
-var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
-var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
+var nsMsgSearchScope = Ci.nsMsgSearchScope;
+var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
+var nsMsgSearchOp = Ci.nsMsgSearchOp;
// perform the view/action requested by the aValue string
// and set the view picker label to the aLabel string
function ViewChange(aValue, aLabel)
{
if (aValue == kViewItemCustomize || aValue == kViewItemVirtual)
{
@@ -205,18 +205,18 @@ function LoadCustomMailView(index)
}
function ViewTagKeyword(keyword)
{
PrepareForViewChange();
// create an i supports array to store our search terms
- var searchTermsArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var searchTermsArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
var term = gSearchSession.createTerm();
var value = term.value;
value.str = keyword;
value.attrib = nsMsgSearchAttrib.Keywords;
term.value = value;
term.attrib = nsMsgSearchAttrib.Keywords;
term.op = nsMsgSearchOp.Contains;
@@ -229,18 +229,18 @@ function ViewTagKeyword(keyword)
}
function ViewNewMail()
{
PrepareForViewChange();
// create an i supports array to store our search terms
- var searchTermsArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var searchTermsArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
var term = gSearchSession.createTerm();
var value = term.value;
value.status = 1;
value.attrib = nsMsgSearchAttrib.MsgStatus;
term.value = value;
term.attrib = nsMsgSearchAttrib.MsgStatus;
term.op = nsMsgSearchOp.Isnt;
@@ -255,18 +255,18 @@ function ViewNewMail()
}
function ViewNotDeletedMail()
{
PrepareForViewChange();
// create an i supports array to store our search terms
- var searchTermsArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var searchTermsArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
var term = gSearchSession.createTerm();
var value = term.value;
value.status = 0x00200000;
value.attrib = nsMsgSearchAttrib.MsgStatus;
term.value = value;
term.attrib = nsMsgSearchAttrib.MsgStatus;
term.op = nsMsgSearchOp.Isnt;
@@ -284,17 +284,17 @@ function ViewNotDeletedMail()
function AddVirtualFolderTerms(searchTermsArray)
{
// add in any virtual folder terms
var virtualFolderSearchTerms = (gVirtualFolderTerms || gXFVirtualFolderTerms);
if (virtualFolderSearchTerms)
{
for (let i = 0; i < termsArray.length; i++)
{
- let searchTerm = virtualFolderSearchTerms.queryElementAt(i, Components.interfaces.nsIMsgSearchTerm);
+ let searchTerm = virtualFolderSearchTerms.queryElementAt(i, Ci.nsIMsgSearchTerm);
searchTermsArray.appendElement(searchTerm);
}
}
}
function PrepareForViewChange()
{
@@ -337,33 +337,33 @@ function RefreshViewPopup(aViewPopup)
// Only show the "Not Deleted" item for IMAP servers
// that are using the IMAP delete model.
viewNotDeleted.setAttribute("hidden", true);
var msgFolder = folderArray[0];
var server = msgFolder.server;
if (server.type == "imap")
{
let imapServer =
- server.QueryInterface(Components.interfaces.nsIImapIncomingServer);
+ server.QueryInterface(Ci.nsIImapIncomingServer);
if (imapServer.deleteModel == 0) // nsMsgImapDeleteModels.IMAPDelete == 0
{
viewNotDeleted.setAttribute("hidden", false);
viewNotDeleted.setAttribute("checked",
gCurrentViewValue == kViewItemNotDeleted);
}
}
}
function RefreshCustomViewsPopup(aMenupopup)
{
// for each mail view in the msg view list, add an entry in our combo box
if (!gMailViewList)
- gMailViewList = Components.classes["@mozilla.org/messenger/mailviewlist;1"]
- .getService(Components.interfaces.nsIMsgMailViewList);
+ gMailViewList = Cc["@mozilla.org/messenger/mailviewlist;1"]
+ .getService(Ci.nsIMsgMailViewList);
// remove all menuitems
while (aMenupopup.hasChildNodes())
aMenupopup.lastChild.remove();
// now rebuild the list
var currentView = isNaN(gCurrentViewValue) ? kViewItemAll : Number(gCurrentViewValue);
var numItems = gMailViewList.mailViewCount;
for (var i = 0; i < numItems; ++i)
@@ -384,18 +384,18 @@ function RefreshCustomViewsPopup(aMenupo
function RefreshTagsPopup(aMenupopup)
{
// remove all menuitems
while (aMenupopup.hasChildNodes())
aMenupopup.lastChild.remove();
// create tag menuitems
var currentTagKey = isNaN(gCurrentViewValue) ? gCurrentViewValue.substr(kViewTagMarker.length) : "";
- var tagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
- .getService(Components.interfaces.nsIMsgTagService);
+ var tagService = Cc["@mozilla.org/messenger/tagservice;1"]
+ .getService(Ci.nsIMsgTagService);
var tagArray = tagService.getAllTags({});
for (var i = 0; i < tagArray.length; ++i)
{
var tagInfo = tagArray[i];
var menuitem = document.createElement("menuitem");
menuitem.setAttribute("label", tagInfo.tag);
menuitem.setAttribute("value", kViewTagMarker + tagInfo.key);
menuitem.setAttribute("name", "viewmessages");
--- a/suite/mailnews/nsDragAndDrop.js
+++ b/suite/mailnews/nsDragAndDrop.js
@@ -38,18 +38,18 @@ var nsTransferable = {
{
var currData = aTransferDataSet.dataList[i];
var currFlavour = currData.flavour.contentType;
trans.addDataFlavor(currFlavour);
var supports = null; // nsISupports data
var length = 0;
if (currData.flavour.dataIIDKey == "nsISupportsString")
{
- supports = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ supports = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
supports.data = currData.supports;
length = supports.data.length;
}
else
{
// non-string data.
supports = currData.supports;
@@ -85,17 +85,17 @@ var nsTransferable = {
var array = aRetrievalFunc(aFlavourSet);
var dataArray = [];
// Iterate over the number of items returned from aRetrievalFunc. For
// clipboard operations, this is 1, for drag and drop (where multiple
// items may have been dragged) this could be >1.
for (let i = 0; i < array.length; i++)
{
- let trans = array.queryElementAt(i, Components.interfaces.nsITransferable);
+ let trans = array.queryElementAt(i, Ci.nsITransferable);
if (!trans)
continue;
var data = { };
var length = { };
var currData = null;
if (aAnyFlag)
@@ -123,18 +123,18 @@ var nsTransferable = {
/**
* nsITransferable createTransferable (void) ;
*
* Creates and returns a transferable object.
**/
createTransferable: function ()
{
const kXferableContractID = "@mozilla.org/widget/transferable;1";
- const kXferableIID = Components.interfaces.nsITransferable;
- var trans = Components.classes[kXferableContractID].createInstance(kXferableIID);
+ const kXferableIID = Ci.nsITransferable;
+ var trans = Cc[kXferableContractID].createInstance(kXferableIID);
trans.init(null);
return trans;
}
};
/**
* A FlavourSet is a simple type that represents a collection of Flavour objects.
* FlavourSet is constructed from an array of Flavours, and stores this list as
@@ -243,20 +243,20 @@ function FlavourData(aData, aLength, aFl
this._XferID = "FlavourData";
}
FlavourData.prototype = {
get data ()
{
if (this.flavour &&
this.flavour.dataIIDKey != "nsISupportsString")
- return this.supports.QueryInterface(Components.interfaces[this.flavour.dataIIDKey]);
+ return this.supports.QueryInterface(Ci[this.flavour.dataIIDKey]);
var supports = this.supports;
- if (supports instanceof Components.interfaces.nsISupportsString)
+ if (supports instanceof Ci.nsISupportsString)
return supports.data.substring(0, this.contentLength/2);
return supports;
}
}
/**
* Create a TransferData object with a single FlavourData entry. Used when
@@ -272,22 +272,22 @@ var transferUtils = {
retrieveURLFromData: function (aData, flavour)
{
switch (flavour) {
case "text/unicode":
case "text/plain":
case "text/x-moz-text-internal":
return aData.replace(/^\s+|\s+$/g, "");
case "text/x-moz-url":
- return ((aData instanceof Components.interfaces.nsISupportsString) ? aData.toString() : aData).split("\n")[0];
+ return ((aData instanceof Ci.nsISupportsString) ? aData.toString() : aData).split("\n")[0];
case "application/x-moz-file":
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
var fileHandler = ioService.getProtocolHandler("file")
- .QueryInterface(Components.interfaces.nsIFileProtocolHandler);
+ .QueryInterface(Ci.nsIFileProtocolHandler);
return fileHandler.getURLSpecFromFile(aData);
}
return null;
}
}
/**
@@ -318,18 +318,18 @@ var transferUtils = {
var nsDragAndDrop = {
_mDS: null,
get mDragService()
{
if (!this._mDS)
{
const kDSContractID = "@mozilla.org/widget/dragservice;1";
- const kDSIID = Components.interfaces.nsIDragService;
- this._mDS = Components.classes[kDSContractID].getService(kDSIID);
+ const kDSIID = Ci.nsIDragService;
+ this._mDS = Cc[kDSContractID].getService(kDSIID);
}
return this._mDS;
},
/**
* void startDrag (DOMEvent aEvent, Object aDragDropObserver) ;
*
* called when a drag on an element is started.
@@ -340,17 +340,17 @@ var nsDragAndDrop = {
* javascript object of format described above that specifies
* the way in which the element responds to drag events.
**/
startDrag: function (aEvent, aDragDropObserver)
{
if (!("onDragStart" in aDragDropObserver))
return;
- const kDSIID = Components.interfaces.nsIDragService;
+ const kDSIID = Ci.nsIDragService;
var dragAction = { action: kDSIID.DRAGDROP_ACTION_COPY + kDSIID.DRAGDROP_ACTION_MOVE + kDSIID.DRAGDROP_ACTION_LINK };
var transferData = { data: null };
try
{
aDragDropObserver.onDragStart(aEvent, transferData, dragAction);
}
catch (e)
@@ -367,17 +367,17 @@ var nsDragAndDrop = {
var tds = transferData._XferID == "TransferData"
? transferData
: transferData.dataList[count]
for (var i = 0; i < tds.dataList.length; ++i)
{
var currData = tds.dataList[i];
var currFlavour = currData.flavour.contentType;
var value = currData.supports;
- if (value instanceof Components.interfaces.nsISupportsString)
+ if (value instanceof Ci.nsISupportsString)
value = value.toString();
dt.mozSetDataAt(currFlavour, value, count);
}
count++;
}
while (transferData._XferID == "TransferDataSet" &&
count < transferData.dataList.length);
@@ -559,31 +559,30 @@ var nsDragAndDrop = {
// sure the source document can load the dropped URI. We don't
// so much care about creating the real URI here
// (i.e. encoding differences etc don't matter), we just want
// to know if aDraggedText really is a URI.
aDraggedText = aDraggedText.replace(/^\s*|\s*$/g, '');
var uri;
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ioService = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
try {
uri = ioService.newURI(aDraggedText);
} catch (e) {
}
if (!uri)
return;
// aDraggedText is a URI, do the security check.
- const nsIScriptSecurityManager = Components.interfaces
- .nsIScriptSecurityManager;
- var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
- .getService(nsIScriptSecurityManager);
+ const nsIScriptSecurityManager = Ci.nsIScriptSecurityManager;
+ var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
+ .getService(nsIScriptSecurityManager);
if (!aDragSession)
aDragSession = this.mDragService.getCurrentSession();
var sourceDoc = aDragSession.sourceDocument;
// Use "file:///" as the default sourceURI so that drops of file:// URIs
// are always allowed.
var principal = sourceDoc ? sourceDoc.nodePrincipal
--- a/suite/mailnews/phishingDetector.js
+++ b/suite/mailnews/phishingDetector.js
@@ -30,24 +30,24 @@ function isMsgEmailScam(aUrl)
// we are opening an .eml file.
var folder = aUrl.folder;
// Ignore NNTP and RSS messages.
if (folder.server.type == 'nntp' || folder.server.type == 'rss')
return isEmailScam;
// Also ignore messages in Sent/Drafts/Templates/Outbox.
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
let outgoingFlags = nsMsgFolderFlags.SentMail | nsMsgFolderFlags.Drafts |
nsMsgFolderFlags.Templates | nsMsgFolderFlags.Queue;
if (folder.isSpecialFolder(outgoingFlags, true))
return isEmailScam;
} catch (ex) {
- if (ex.result != Components.results.NS_ERROR_FAILURE)
+ if (ex.result != Cr.NS_ERROR_FAILURE)
throw ex;
}
// loop through all of the link nodes in the message's DOM, looking for phishing URLs...
var msgDocument = document.getElementById('messagepane').contentDocument;
var index;
// examine all links...
--- a/suite/mailnews/prefs/pref-junk.js
+++ b/suite/mailnews/prefs/pref-junk.js
@@ -31,14 +31,14 @@ function ResetTrainingData()
// if the user says no, then just fall out
if (Services.prompt.confirmEx(window, title, text,
Services.prompt.STD_YES_NO_BUTTONS |
Services.prompt.BUTTON_POS_1_DEFAULT,
"", "", "", null, {}))
return;
// otherwise go ahead and remove the training data
- var junkmailPlugin = Components.classes["@mozilla.org/messenger/filter-plugin;1?name=bayesianfilter"]
- .getService(Components.interfaces.nsIJunkMailPlugin);
+ var junkmailPlugin = Cc["@mozilla.org/messenger/filter-plugin;1?name=bayesianfilter"]
+ .getService(Ci.nsIJunkMailPlugin);
if (junkmailPlugin)
junkmailPlugin.resetTrainingData();
}
--- a/suite/mailnews/prefs/pref-mailnews.js
+++ b/suite/mailnews/prefs/pref-mailnews.js
@@ -1,15 +1,15 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
if ("@mozilla.org/suite/shell-service;1" in Components.classes)
- var nsIShellService = Components.interfaces.nsIShellService;
+ var nsIShellService = Ci.nsIShellService;
function Startup()
{
startPageCheck();
defaultClientSetup();
}
function startPageCheck()
@@ -26,36 +26,36 @@ function setHomePageToDefaultPage()
var startPagePref = document.getElementById("mailnews.start_page.url");
startPagePref.value = startPagePref.defaultValue;
}
function defaultClientSetup()
{
if ("@mozilla.org/suite/shell-service;1" in Components.classes) try {
- var shellService = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ var shellService = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
["Mail", "News", "Rss"].forEach(function(aType) {
var button = document.getElementById("setDefault" + aType);
try {
button.disabled = shellService.isDefaultClient(false, nsIShellService[aType.toUpperCase()]);
document.getElementById("defaultMailPrefs").hidden = false;
} catch (e) {
button.hidden = true;
}
});
} catch (e) {
}
}
function onSetDefault(aButton, aType)
{
- var shellService = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ var shellService = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
shellService.setDefaultClient(false, false, nsIShellService[aType]);
shellService.shouldBeDefaultClientFor |= nsIShellService[aType];
aButton.disabled = true;
}
function onNewsChange(aChecked)
--- a/suite/mailnews/prefs/pref-tags.js
+++ b/suite/mailnews/prefs/pref-tags.js
@@ -13,18 +13,18 @@
// </listitem>
// For ease of handling, all tag data is stored in <listitem>.tagInfo also.
const kOrdinalCharLow = "a";
const kOrdinalCharHigh = "z";
const kOrdinalPadding = String.fromCharCode(kOrdinalCharLow.charCodeAt(0) - 1);
var gInstantApply = document.documentElement.instantApply; // read only once
-var gTagService = Components.classes["@mozilla.org/messenger/tagservice;1"]
- .getService(Components.interfaces.nsIMsgTagService);
+var gTagService = Cc["@mozilla.org/messenger/tagservice;1"]
+ .getService(Ci.nsIMsgTagService);
var gTagList = null; // tagList root element
var gAddButton = null;
var gDeleteButton = null;
var gRaiseButton = null;
var gLowerButton = null;
var gDeletedTags = {}; // tags marked for deletion in non-instant apply mode
--- a/suite/mailnews/search/ABSearchDialog.js
+++ b/suite/mailnews/search/ABSearchDialog.js
@@ -4,21 +4,21 @@
ChromeUtils.import("resource:///modules/ABQueryUtils.jsm");
ChromeUtils.import("resource:///modules/mailServices.js");
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
var searchSessionContractID = "@mozilla.org/messenger/searchSession;1";
var gSearchSession;
-var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
-var nsIMsgSearchTerm = Components.interfaces.nsIMsgSearchTerm;
-var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
-var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
-var nsIAbDirectory = Components.interfaces.nsIAbDirectory;
+var nsMsgSearchScope = Ci.nsMsgSearchScope;
+var nsIMsgSearchTerm = Ci.nsIMsgSearchTerm;
+var nsMsgSearchOp = Ci.nsMsgSearchOp;
+var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
+var nsIAbDirectory = Ci.nsIAbDirectory;
var gStatusText;
var gSearchBundle;
var gAddressBookBundle;
var gSearchStopButton;
var gPropertiesButton;
var gComposeButton;
@@ -49,17 +49,17 @@ function searchOnLoad()
initializeSearchWidgets();
initializeSearchWindowWidgets();
gSearchBundle = document.getElementById("bundle_search");
gSearchStopButton.setAttribute("label", gSearchBundle.getString("labelForSearchButton"));
gSearchStopButton.setAttribute("accesskey", gSearchBundle.getString("labelForSearchButton.accesskey"));
gAddressBookBundle = document.getElementById("bundle_addressBook");
- gSearchSession = Components.classes[searchSessionContractID].createInstance(Components.interfaces.nsIMsgSearchSession);
+ gSearchSession = Cc[searchSessionContractID].createInstance(Ci.nsIMsgSearchSession);
// initialize a flag for phonetic name search
gSearchPhoneticName =
GetLocalizedStringPref("mail.addr_book.show_phonetic_fields");
if (window.arguments && window.arguments[0])
SelectDirectory(window.arguments[0].directory);
else
--- a/suite/mailnews/search/FilterListDialog.js
+++ b/suite/mailnews/search/FilterListDialog.js
@@ -116,24 +116,24 @@ var gFilterTreeView = {
isSelectable: function isSelectable(row, col) { return false; },
setCellValue: function setCellValue(row, col, value) {},
setCellText: function setCellText(row, col, value) { /* XXX Write me */ },
performAction: function performAction(action) {},
performActionOnRow: function performActionOnRow(action, row) {},
performActionOnCell: function performActionOnCell(action, row, col) {}
}
-const nsMsgFilterMotion = Components.interfaces.nsMsgFilterMotion;
+const nsMsgFilterMotion = Ci.nsMsgFilterMotion;
function onLoad()
{
setHelpFileURI("chrome://communicator/locale/help/suitehelp.rdf");
- gFilterListMsgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"].createInstance(Components.interfaces.nsIMsgWindow);
+ gFilterListMsgWindow = Cc["@mozilla.org/messenger/msgwindow;1"].createInstance(Ci.nsIMsgWindow);
gFilterListMsgWindow.domWindow = window;
- gFilterListMsgWindow.rootDocShell.appType = Components.interfaces.nsIDocShell.APP_TYPE_MAIL;
+ gFilterListMsgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
gFilterListMsgWindow.statusFeedback = gStatusFeedback;
gFilterBundle = document.getElementById("bundle_filter");
gFilterTree = document.getElementById("filterTree");
gEditButton = document.getElementById("editButton");
gDeleteButton = document.getElementById("deleteButton");
gReorderUpButton = document.getElementById("reorderUpButton");
@@ -370,17 +370,17 @@ function onFilterUnload()
Services.obs.removeObserver(onFilterClose, "quit-application-requested");
top.controllers.removeController(gFilterController);
}
function onFilterClose(aCancelQuit, aTopic, aData)
{
if (aTopic == "quit-application-requested" &&
- aCancelQuit instanceof Components.interfaces.nsISupportsPRBool &&
+ aCancelQuit instanceof Ci.nsISupportsPRBool &&
aCancelQuit.data)
return false;
if (gRunFiltersButton.getAttribute("label") == gRunFiltersButton.getAttribute("stoplabel")) {
var promptTitle = gFilterBundle.getString("promptTitle");
var promptMsg = gFilterBundle.getString("promptMsg");;
var stopButtonLabel = gFilterBundle.getString("stopButtonLabel");
var continueButtonLabel = gFilterBundle.getString("continueButtonLabel");
@@ -405,18 +405,18 @@ function runSelectedFilters()
// if run button has "stop" label, do stop.
if (gRunFiltersButton.getAttribute("label") == gRunFiltersButton.getAttribute("stoplabel")) {
gFilterListMsgWindow.StopUrls();
return;
}
var msgFolder = gRunFiltersFolderPicker._folder || gRunFiltersFolderPicker.selectedItem._folder;
var filterList = MailServices.filters.getTempFilterList(msgFolder);
- var folders = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var folders = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
folders.appendElement(msgFolder);
// make sure the tmp filter list uses the real filter list log stream
filterList.logStream = currentFilterList().logStream;
filterList.loggingEnabled = currentFilterList().loggingEnabled;
var index = 0, sel = gFilterTree.view.selection;
for (var i = 0; i < sel.getRangeCount(); i++) {
var start = {}, end = {};
@@ -481,17 +481,17 @@ function updateButtons()
*/
function getFilterFolderForSelection()
{
var args = window.arguments;
var selectedFolder = args[0].folder;
if (args && args[0] && selectedFolder)
{
- var msgFolder = selectedFolder.QueryInterface(Components.interfaces.nsIMsgFolder);
+ var msgFolder = selectedFolder.QueryInterface(Ci.nsIMsgFolder);
try
{
var rootFolder = msgFolder.server.rootFolder;
if (rootFolder.isServer)
{
var server = rootFolder.server;
if (server.canHaveFilters)
@@ -523,17 +523,17 @@ function getServerThatCanHaveFilters()
// if it cannot, check all accounts to find a server
// that can have filters
var allServers = MailServices.accounts.allServers;
var numServers = allServers.length;
for (var index = 0; index < numServers; index++)
{
var currentServer =
- allServers.queryElementAt(index, Components.interfaces.nsIMsgIncomingServer);
+ allServers.queryElementAt(index, Ci.nsIMsgIncomingServer);
if (currentServer.canHaveFilters)
return currentServer;
}
return null;
}
@@ -606,17 +606,17 @@ function getFirstFolder(msgFolder)
try {
// Choose Folder for feeds.
if (msgFolder.server.type == "rss")
return null;
// Find Inbox for imap and pop
if (msgFolder.server.type != "nntp")
{
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
var inboxFolder = msgFolder.getFolderWithFlags(nsMsgFolderFlags.Inbox);
if (inboxFolder)
return inboxFolder;
else
// If inbox does not exist then use the server as default.
return msgFolder;
}
--- a/suite/mailnews/search/SearchDialog.js
+++ b/suite/mailnews/search/SearchDialog.js
@@ -5,19 +5,19 @@
ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
var searchSessionContractID = "@mozilla.org/messenger/searchSession;1";
var gDBView;
var gSearchSession;
var gMsgFolderSelected;
-var nsIMsgFolder = Components.interfaces.nsIMsgFolder;
-var nsIMsgWindow = Components.interfaces.nsIMsgWindow;
-var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
+var nsIMsgFolder = Ci.nsIMsgFolder;
+var nsIMsgWindow = Ci.nsIMsgWindow;
+var nsMsgSearchScope = Ci.nsMsgSearchScope;
var gFolderDatasource;
var gFolderPicker;
var gStatusBar = null;
var gStatusFeedback = new nsMsgStatusFeedback();
var gTimelineEnabled = false;
var gMessengerBundle = null;
var RDF;
@@ -166,17 +166,17 @@ var gSearchNotificationListener =
// update status text?
},
onSearchDone: function(status)
{
gSearchStopButton.setAttribute("label", gSearchBundle.getString("labelForSearchButton"));
gSearchStopButton.setAttribute("accesskey", gSearchBundle.getString("labelForSearchButton.accesskey"));
gStatusFeedback._stopMeteors();
- SetAdvancedSearchStatusText(gDBView.QueryInterface(Components.interfaces.nsITreeView).rowCount);
+ SetAdvancedSearchStatusText(gDBView.QueryInterface(Ci.nsITreeView).rowCount);
},
onNewSearch: function()
{
gSearchStopButton.setAttribute("label", gSearchBundle.getString("labelForStopButton"));
gSearchStopButton.setAttribute("accesskey", gSearchBundle.getString("labelForStopButton.accesskey"));
UpdateMailSearch("new-search");
gStatusFeedback._startMeteors();
@@ -227,18 +227,18 @@ function ShowSearchColumn(id)
}
}
function searchOnLoad()
{
setHelpFileURI("chrome://communicator/locale/help/suitehelp.rdf");
initializeSearchWidgets();
initializeSearchWindowWidgets();
- messenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ messenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
gSearchBundle = document.getElementById("bundle_search");
gSearchStopButton.setAttribute("label", gSearchBundle.getString("labelForSearchButton"));
gSearchStopButton.setAttribute("accesskey", gSearchBundle.getString("labelForSearchButton.accesskey"));
gMessengerBundle = document.getElementById("bundle_messenger");
setupDatasource();
setupSearchListener();
@@ -262,19 +262,19 @@ function searchOnLoad()
}
function searchOnUnload()
{
// unregister listeners
gSearchSession.unregisterListener(gViewSearchListener);
gSearchSession.unregisterListener(gSearchNotificationListener);
- Components.classes["@mozilla.org/messenger/services/session;1"]
- .getService(Components.interfaces.nsIMsgMailSession)
- .RemoveFolderListener(gFolderListener);
+ Cc["@mozilla.org/messenger/services/session;1"]
+ .getService(Ci.nsIMsgMailSession)
+ .RemoveFolderListener(gFolderListener);
if (gDBView)
{
gDBView.close();
gDBView = null;
}
top.controllers.removeController(nsSearchResultsController);
@@ -285,21 +285,21 @@ function searchOnUnload()
function initializeSearchWindowWidgets()
{
gFolderPicker = document.getElementById("searchableFolders");
gSearchStopButton = document.getElementById("search-button");
gStatusBar = document.getElementById('statusbar-icon');
hideMatchAllItem();
- msgWindow = Components.classes["@mozilla.org/messenger/msgwindow;1"]
- .createInstance(nsIMsgWindow);
+ msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"]
+ .createInstance(nsIMsgWindow);
msgWindow.domWindow = window;
msgWindow.rootDocShell.allowAuth = true;
- msgWindow.rootDocShell.appType = Components.interfaces.nsIDocShell.APP_TYPE_MAIL;
+ msgWindow.rootDocShell.appType = Ci.nsIDocShell.APP_TYPE_MAIL;
msgWindow.statusFeedback = gStatusFeedback;
// functionality to enable/disable buttons using nsSearchResultsController
// depending of whether items are selected in the search results thread pane.
top.controllers.insertControllerAt(0, nsSearchResultsController);
}
@@ -316,17 +316,17 @@ function onResetSearch(event) {
}
function selectFolder(folder)
{
var folderURI;
// if we can't search messages on this folder, just select the first one
if (!folder || !folder.server.canSearchMessages ||
- (folder.flags & Components.interfaces.nsMsgFolderFlags.Virtual)) {
+ (folder.flags & Ci.nsMsgFolderFlags.Virtual)) {
// find first item in our folder picker menu list
folderURI = gFolderPicker.firstChild.tree.builderView.getResourceAtIndex(0).Value;
} else {
folderURI = folder.URI;
}
updateSearchFolderPicker(folderURI);
}
@@ -376,17 +376,17 @@ function onEnterInSearchTerm()
onSearch();
}
}
function onSearch()
{
// set the view. do this on every search, to
// allow the tree to reset itself
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView);
if (treeView)
{
var tree = GetThreadTree();
tree.treeBoxObject.view = treeView;
}
gSearchSession.clearScopes();
// tell the search session what the new scope is
@@ -414,19 +414,19 @@ function onSearch()
// search will cause the datasource to clear itself
}
function AddSubFolders(folder) {
var subFolders = folder.subFolders;
while (subFolders.hasMoreElements())
{
var nextFolder =
- subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
+ subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
- if (!(nextFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual))
+ if (!(nextFolder.flags & Ci.nsMsgFolderFlags.Virtual))
{
if (!nextFolder.noSelect)
gSearchSession.addScopeTerm(GetScopeForFolder(nextFolder), nextFolder);
AddSubFolders(nextFolder);
}
}
}
@@ -435,19 +435,19 @@ function AddSubFoldersToURI(folder)
{
var returnString = "";
var subFolders = folder.subFolders;
while (subFolders.hasMoreElements())
{
var nextFolder =
- subFolders.getNext().QueryInterface(Components.interfaces.nsIMsgFolder);
+ subFolders.getNext().QueryInterface(Ci.nsIMsgFolder);
- if (!(nextFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual))
+ if (!(nextFolder.flags & Ci.nsMsgFolderFlags.Virtual))
{
if (!nextFolder.noSelect && !nextFolder.isServer)
{
if (returnString.length > 0)
returnString += '|';
returnString += nextFolder.URI;
}
var subFoldersString = AddSubFoldersToURI(nextFolder);
@@ -466,20 +466,20 @@ function AddSubFoldersToURI(folder)
function GetScopeForFolder(folder)
{
var searchLocalSystem = document.getElementById("menuSearchLocalSystem");
return searchLocalSystem && searchLocalSystem.value == "local" ?
nsMsgSearchScope.offlineMail :
folder.server.searchScope;
}
-var nsMsgViewSortType = Components.interfaces.nsMsgViewSortType;
-var nsMsgViewSortOrder = Components.interfaces.nsMsgViewSortOrder;
-var nsMsgViewFlagsType = Components.interfaces.nsMsgViewFlagsType;
-var nsMsgViewCommandType = Components.interfaces.nsMsgViewCommandType;
+var nsMsgViewSortType = Ci.nsMsgViewSortType;
+var nsMsgViewSortOrder = Ci.nsMsgViewSortOrder;
+var nsMsgViewFlagsType = Ci.nsMsgViewFlagsType;
+var nsMsgViewCommandType = Ci.nsMsgViewCommandType;
function goUpdateSearchItems(commandset)
{
for (var i = 0; i < commandset.childNodes.length; i++)
{
var commandID = commandset.childNodes[i].getAttribute("id");
if (commandID)
{
@@ -507,62 +507,62 @@ nsMsgSearchCommandUpdater.prototype =
{
SetNextMessageAfterDelete();
},
summarizeSelection: function() {return false},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIMsgDBViewCommandUpdater) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIMsgDBViewCommandUpdater) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
}
function setupDatasource() {
- gDBView = Components.classes["@mozilla.org/messenger/msgdbview;1?type=search"]
- .createInstance(Components.interfaces.nsIMsgDBView);
+ gDBView = Cc["@mozilla.org/messenger/msgdbview;1?type=search"]
+ .createInstance(Ci.nsIMsgDBView);
var count = new Object;
var cmdupdator = new nsMsgSearchCommandUpdater();
gDBView.init(messenger, msgWindow, cmdupdator);
gDBView.open(null, nsMsgViewSortType.byId, nsMsgViewSortOrder.ascending, nsMsgViewFlagsType.kNone, count);
// the thread pane needs to use the search datasource (to get the
// actual list of messages) and the message datasource (to get any
// attributes about each message)
- gSearchSession = Components.classes[searchSessionContractID].createInstance(Components.interfaces.nsIMsgSearchSession);
+ gSearchSession = Cc[searchSessionContractID].createInstance(Ci.nsIMsgSearchSession);
- var nsIFolderListener = Components.interfaces.nsIFolderListener;
+ var nsIFolderListener = Ci.nsIFolderListener;
var notifyFlags = nsIFolderListener.event;
- Components.classes["@mozilla.org/messenger/services/session;1"]
- .getService(Components.interfaces.nsIMsgMailSession)
- .AddFolderListener(gFolderListener, notifyFlags);
+ Cc["@mozilla.org/messenger/services/session;1"]
+ .getService(Ci.nsIMsgMailSession)
+ .AddFolderListener(gFolderListener, notifyFlags);
// the datasource is a listener on the search results
- gViewSearchListener = gDBView.QueryInterface(Components.interfaces.nsIMsgSearchNotify);
+ gViewSearchListener = gDBView.QueryInterface(Ci.nsIMsgSearchNotify);
gSearchSession.registerListener(gViewSearchListener);
}
function setupSearchListener()
{
// Setup the javascript object as a listener on the search results
gSearchSession.registerListener(gSearchNotificationListener);
}
// stuff after this is implemented to make the thread pane work
function GetFolderDatasource()
{
if (!gFolderDatasource)
- gFolderDatasource = Components.classes["@mozilla.org/rdf/datasource;1?name=mailnewsfolders"]
- .getService(Components.interfaces.nsIRDFDataSource);
+ gFolderDatasource = Cc["@mozilla.org/rdf/datasource;1?name=mailnewsfolders"]
+ .getService(Ci.nsIRDFDataSource);
return gFolderDatasource;
}
// used to determine if we should try to load a message
function IsThreadAndMessagePaneSplitterCollapsed()
{
return true;
}
@@ -607,17 +607,17 @@ function HandleDeleteOrMoveMessageFailed
{
gDBView.onDeleteCompleted(false);
gNextMessageViewIndexAfterDelete = -2;
}
function HandleDeleteOrMoveMessageCompleted(folder)
{
gDBView.onDeleteCompleted(true);
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView);
var treeSelection = treeView.selection;
var viewSize = treeView.rowCount;
if (gNextMessageViewIndexAfterDelete == -2) {
// a move or delete can cause our selection can change underneath us.
// this can happen when the user
// deletes message from the stand alone msg window
// or the three pane
--- a/suite/mailnews/searchBar.js
+++ b/suite/mailnews/searchBar.js
@@ -45,32 +45,32 @@ var gSearchNotificationListener =
if (!header.isRead)
gNumUnreadMessages++;
// XXX todo
// update status text?
},
onSearchDone: function(status)
{
- SetQSStatusText(gDBView.QueryInterface(Components.interfaces.nsITreeView).rowCount)
+ SetQSStatusText(gDBView.QueryInterface(Ci.nsITreeView).rowCount)
statusFeedback.showProgress(0);
gProgressMeter.setAttribute("mode", "normal");
gSearchInProgress = false;
// ### TODO need to find out if there's quick search within a virtual folder.
if (gCurrentVirtualFolderUri &&
(!gSearchInput || gSearchInput.value == ""))
{
var vFolder = GetMsgFolderFromUri(gCurrentVirtualFolderUri, false);
var dbFolderInfo = vFolder.msgDatabase.dBFolderInfo;
dbFolderInfo.numUnreadMessages = gNumUnreadMessages;
dbFolderInfo.numMessages = gNumTotalMessages;
vFolder.updateSummaryTotals(true); // force update from db.
var msgdb = vFolder.msgDatabase;
- msgdb.Commit(Components.interfaces.nsMsgDBCommitType.kLargeCommit);
+ msgdb.Commit(Ci.nsMsgDBCommitType.kLargeCommit);
// now that we have finished loading a virtual folder,
// scroll to the correct message if there is at least one.
if (vFolder.getTotalMessages(false) > 0)
ScrollToMessageAfterFolderLoad(vFolder);
}
},
onNewSearch: function()
@@ -89,17 +89,17 @@ function getDocumentElements()
gSearchBundle = document.getElementById("bundle_search");
gProgressMeter = document.getElementById('statusbar-icon');
gClearButton = document.getElementById('clearButton');
GetSearchInput();
}
function addListeners()
{
- gViewSearchListener = gDBView.QueryInterface(Components.interfaces.nsIMsgSearchNotify);
+ gViewSearchListener = gDBView.QueryInterface(Ci.nsIMsgSearchNotify);
gSearchSession.registerListener(gViewSearchListener);
}
function removeListeners()
{
gSearchSession.unregisterListener(gViewSearchListener);
}
@@ -115,37 +115,37 @@ function initializeGlobalListeners()
gSearchSession.registerListener(gSearchNotificationListener);
}
function createQuickSearchView()
{
//if not already in quick search view
if (gDBView.viewType != nsMsgViewType.eShowQuickSearchResults)
{
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView); //clear selection
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView); //clear selection
if (treeView && treeView.selection)
treeView.selection.clearSelection();
gPreQuickSearchView = gDBView;
if (gDBView.viewType == nsMsgViewType.eShowVirtualFolderResults)
{
// remove the view as a listener on the search results
- var saveViewSearchListener = gDBView.QueryInterface(Components.interfaces.nsIMsgSearchNotify);
+ var saveViewSearchListener = gDBView.QueryInterface(Ci.nsIMsgSearchNotify);
gSearchSession.unregisterListener(saveViewSearchListener);
}
CreateDBView(gDBView.msgFolder, (gXFVirtualFolderTerms) ? nsMsgViewType.eShowVirtualFolderResults : nsMsgViewType.eShowQuickSearchResults, gDBView.viewFlags, gDBView.sortType, gDBView.sortOrder);
}
}
function initializeSearchBar()
{
createQuickSearchView();
if (!gSearchSession)
{
var searchSessionContractID = "@mozilla.org/messenger/searchSession;1";
- gSearchSession = Components.classes[searchSessionContractID].createInstance(Components.interfaces.nsIMsgSearchSession);
+ gSearchSession = Cc[searchSessionContractID].createInstance(Ci.nsIMsgSearchSession);
initializeGlobalListeners();
}
else
{
if (gSearchInProgress)
{
onSearchStop();
gSearchInProgress = false;
@@ -220,17 +220,17 @@ function restorePreSearchView()
gDBView = null;
if (gPreQuickSearchView)
{
gDBView = gPreQuickSearchView;
if (gDBView.viewType == nsMsgViewType.eShowVirtualFolderResults)
{
// readd the view as a listener on the search results
- var saveViewSearchListener = gDBView.QueryInterface(Components.interfaces.nsIMsgSearchNotify);
+ var saveViewSearchListener = gDBView.QueryInterface(Ci.nsIMsgSearchNotify);
if (gSearchSession)
gSearchSession.registerListener(saveViewSearchListener);
}
// dump ("view type = " + gDBView.viewType + "\n");
if (sortType != gDBView.sortType || sortOrder != gDBView.sortOrder)
{
gDBView.sort(sortType, sortOrder);
@@ -245,17 +245,17 @@ function restorePreSearchView()
RerootThreadPane();
var scrolled = false;
// now restore selection
if (selectedHdr)
{
gDBView.selectMsgByKey(selectedHdr.messageKey);
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView);
var selectedIndex = treeView.selection.currentIndex;
if (selectedIndex >= 0)
{
// scroll
EnsureRowInThreadTreeIsVisible(selectedIndex);
scrolled = true;
}
else
@@ -283,19 +283,19 @@ function onSearch(aSearchTerms)
catch(ex)
{
dump("Search Exception\n");
}
}
function createSearchTermsWithList(aTermsArray)
{
- var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
- var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
+ var nsMsgSearchScope = Ci.nsMsgSearchScope;
+ var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
+ var nsMsgSearchOp = Ci.nsMsgSearchOp;
gSearchSession.searchTerms.clear();
gSearchSession.clearScopes();
var i;
var selectedFolder = GetThreadPaneFolder();
if (gXFVirtualFolderTerms)
{
@@ -316,30 +316,30 @@ function createSearchTermsWithList(aTerm
}
else
{
viewDebug ("in createSearchTermsWithList, adding scope term for selected folder\n");
gSearchSession.addScopeTerm(nsMsgSearchScope.offlineMail, selectedFolder);
}
// Add each item in aTermsArray to the search session.
- for (let term of fixIterator(aTermsArray, Components.interfaces.nsIMsgSearchTerm)) {
+ for (let term of fixIterator(aTermsArray, Ci.nsIMsgSearchTerm)) {
gSearchSession.appendTerm(term);
}
}
function createSearchTerms()
{
- var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;
- var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;
- var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;
+ var nsMsgSearchScope = Ci.nsMsgSearchScope;
+ var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
+ var nsMsgSearchOp = Ci.nsMsgSearchOp;
// create an nsIMutableArray to store our search terms
- var searchTermsArray = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ var searchTermsArray = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
var selectedFolder = GetThreadPaneFolder();
// implement | for QS
// does this break if the user types "foo|bar" expecting to see subjects with that string?
// I claim no, since "foo|bar" will be a hit for "foo" || "bar"
// they just might get more false positives
var termList = gSearchInput.value.split("|");
for (var i = 0; i < termList.length; i ++)
@@ -371,17 +371,17 @@ function createSearchTerms()
// now append the default view or virtual folder criteria to the quick search
// so we don't lose any default view information
viewDebug("gDefaultSearchViewTerms = " + gDefaultSearchViewTerms + "gVirtualFolderTerms = " + gVirtualFolderTerms +
"gXFVirtualFolderTerms = " + gXFVirtualFolderTerms + "\n");
var defaultSearchTerms = (gDefaultSearchViewTerms || gVirtualFolderTerms || gXFVirtualFolderTerms);
if (defaultSearchTerms)
{
- for (let searchTerm of fixIterator(defaultSearchTerms, Components.interfaces.nsIMsgSearchTerm))
+ for (let searchTerm of fixIterator(defaultSearchTerms, Ci.nsIMsgSearchTerm))
{
searchTermsArray.appendElement(searchTerm);
}
}
createSearchTermsWithList(searchTermsArray);
// now that we've added the terms, clear out our input array
--- a/suite/mailnews/tabmail.js
+++ b/suite/mailnews/tabmail.js
@@ -160,18 +160,18 @@ var gMailNewsTabsType =
/**
* Create the new tab's state, which engenders some side effects.
* Part of our contract is that we leave the tab in the selected state.
*/
openTab: function(aTabInfo)
{
// each tab gets its own messenger instance
// for undo/redo, backwards/forwards, etc.
- messenger = Components.classes["@mozilla.org/messenger;1"]
- .createInstance(Components.interfaces.nsIMessenger);
+ messenger = Cc["@mozilla.org/messenger;1"]
+ .createInstance(Ci.nsIMessenger);
messenger.setWindow(window, msgWindow);
aTabInfo.messenger = messenger;
// remember the currently selected folder
aTabInfo.msgSelectedFolder = gMsgFolderSelected;
// show tab if permitted
if (aTabInfo.switchToNewTab)
@@ -207,17 +207,17 @@ var gMailNewsTabsType =
messenger.setWindow(window, msgWindow);
// Clear thread pane selection - otherwise, the tree tries to impose the
// the current selection on the new view.
let msgHdr = aTabInfo.hdr;
let msgId = aTabInfo.selectedMsgId;
SelectFolder(aTabInfo.uriToOpen);
let folderResource = RDF.GetResource(aTabInfo.uriToOpen);
- if (folderResource instanceof Components.interfaces.nsIMsgFolder)
+ if (folderResource instanceof Ci.nsIMsgFolder)
aTabInfo.msgSelectedFolder = folderResource;
gCurrentFolderToReroot = null;
delete aTabInfo.uriToOpen; // destroy after use!
// restore our message data
aTabInfo.hdr = msgHdr;
aTabInfo.selectedMsgId = msgId;
aTabInfo.dbView = gDBView;
@@ -382,19 +382,19 @@ var gMailNewsTabsType =
// quick search
aTabInfo.searchInput = GetSearchInput().value;
},
onTitleChanged: function(aTabInfo, aTabNode)
{
// If we have an account, we also always have a "Local Folders" account,
- let accountCount = Components.classes["@mozilla.org/messenger/account-manager;1"]
- .getService(Components.interfaces.nsIMsgAccountManager)
- .accounts.length;
+ let accountCount = Cc["@mozilla.org/messenger/account-manager;1"]
+ .getService(Ci.nsIMsgAccountManager)
+ .accounts.length;
let multipleRealAccounts = accountCount > 2;
// clear out specific tab data now, because we might need to return early
aTabNode.removeAttribute("SpecialFolder");
aTabNode.removeAttribute("ServerType");
aTabNode.removeAttribute("IsServer");
aTabNode.removeAttribute("IsSecure");
aTabNode.removeAttribute("NewMessages");
@@ -407,17 +407,17 @@ var gMailNewsTabsType =
// aTabInfo.msgSelectedFolder may contain the base folder of saved search
let msgSelectedFolder = null;
if (aTabInfo.uriToOpen)
{
// select folder for the backgound tab without changing the current one
// (stolen from SelectFolder)
let folderResource = RDF.GetResource(aTabInfo.uriToOpen);
- if (folderResource instanceof Components.interfaces.nsIMsgFolder)
+ if (folderResource instanceof Ci.nsIMsgFolder)
msgSelectedFolder = folderResource;
}
else
{
msgSelectedFolder = (aTabInfo.dbView && aTabInfo.dbView.viewFolder) ||
(aTabInfo.dbView && aTabInfo.dbView.msgFolder) ||
aTabInfo.msgSelectedFolder ||
gMsgFolderSelected;
@@ -461,39 +461,39 @@ var gMailNewsTabsType =
aTabNode.setAttribute("IsServer", msgSelectedFolder.isServer);
aTabNode.setAttribute("IsSecure", msgSelectedFolder.server.isSecure);
aTabNode.setAttribute("NewMessages", msgSelectedFolder.hasNewMessages);
aTabNode.setAttribute("ImapShared", msgSelectedFolder.imapShared);
let biffState = "UnknownMail";
switch (msgSelectedFolder.biffState)
{
- case Components.interfaces.nsIMsgFolder.nsMsgBiffState_NewMail:
+ case Ci.nsIMsgFolder.nsMsgBiffState_NewMail:
biffState = "NewMail";
break;
- case Components.interfaces.nsIMsgFolder.nsMsgBiffState_NoMail:
+ case Ci.nsIMsgFolder.nsMsgBiffState_NoMail:
biffState = "NoMail";
break;
}
aTabNode.setAttribute("BiffState", biffState);
}
else
{
// Message Tab
aTabNode.setAttribute("type", "message"); // override "3pane"
- if (aTabInfo.hdr.flags & Components.interfaces.nsMsgMessageFlags.HasRe)
+ if (aTabInfo.hdr.flags & Ci.nsMsgMessageFlags.HasRe)
aTabInfo.title = "Re: ";
if (aTabInfo.hdr.mime2DecodedSubject)
aTabInfo.title += aTabInfo.hdr.mime2DecodedSubject;
aTabInfo.title += " - " + aTabInfo.hdr.folder.prettyName;
if (multipleRealAccounts)
aTabInfo.title += " - " + aTabInfo.hdr.folder.server.prettyName;
// message specific tab data
- const nsMsgMessageFlags = Components.interfaces.nsMsgMessageFlags;
+ const nsMsgMessageFlags = Ci.nsMsgMessageFlags;
let flags = aTabInfo.hdr.flags;
aTabNode.setAttribute("MessageType", msgSelectedFolder.server.type);
aTabNode.setAttribute("Offline", Boolean(flags & nsMsgMessageFlags.Offline));
aTabNode.setAttribute("Attachment", Boolean(flags & nsMsgMessageFlags.Attachment));
aTabNode.setAttribute("IMAPDeleted", Boolean(flags & nsMsgMessageFlags.IMAPDeleted));
}
},
--- a/suite/mailnews/tabmail.xml
+++ b/suite/mailnews/tabmail.xml
@@ -1230,24 +1230,24 @@
// the background) is not completely visible
if (tsboStart > ctboStart || ctboEnd > tsboEnd)
{
this._animateStep = 0;
if (!this._animateTimer)
this._animateTimer =
- Components.classes["@mozilla.org/timer;1"]
- .createInstance(Components.interfaces.nsITimer);
+ Cc["@mozilla.org/timer;1"]
+ .createInstance(Ci.nsITimer);
else
this._animateTimer.cancel();
this._animateTimer.initWithCallback(this,
this._animateDelay,
- Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
+ Ci.nsITimer.TYPE_REPEATING_SLACK);
}
]]>
</body>
</method>
<method name="notify">
<parameter name="aTimer"/>
<body>
--- a/suite/mailnews/threadPane.js
+++ b/suite/mailnews/threadPane.js
@@ -95,21 +95,21 @@ nsMsgDBViewCommandUpdater.prototype =
{
SetNextMessageAfterDelete();
},
summarizeSelection: function() {return false},
QueryInterface : function(iid)
{
- if (iid.equals(Components.interfaces.nsIMsgDBViewCommandUpdater) ||
- iid.equals(Components.interfaces.nsISupports))
+ if (iid.equals(Ci.nsIMsgDBViewCommandUpdater) ||
+ iid.equals(Ci.nsISupports))
return this;
- throw Components.results.NS_NOINTERFACE;
+ throw Cr.NS_NOINTERFACE;
}
}
function HandleColumnClick(columnID)
{
const columnMap = {dateCol: 'byDate',
receivedCol: 'byReceived',
senderCol: 'byAuthor',
@@ -175,25 +175,25 @@ function HandleColumnClick(columnID)
else {
MsgSortThreadPane(sortType);
}
}
}
function ThreadPaneDoubleClick()
{
- const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
+ const nsMsgFolderFlags = Ci.nsMsgFolderFlags;
if (IsSpecialFolderSelected(nsMsgFolderFlags.Drafts, true))
{
MsgComposeDraftMessage();
}
else if(IsSpecialFolderSelected(nsMsgFolderFlags.Templates, true))
{
- ComposeMsgByType(Components.interfaces.nsIMsgCompType.Template, null,
- Components.interfaces.nsIMsgCompFormat.Default);
+ ComposeMsgByType(Ci.nsIMsgCompType.Template, null,
+ Ci.nsIMsgCompFormat.Default);
}
else if (AllowOpenTabOnDoubleClick() &&
document.documentElement.id != "searchMailWindow")
{ // we don't allow new tabs in the search dialog
// open the message in a new tab on double click
MsgOpenNewTabForMessage();
RestoreSelectionWithoutContentLoad(GetThreadTree());
}
@@ -254,17 +254,17 @@ function MsgToggleThreaded()
function MsgSortThreaded()
{
var dbview = GetDBView();
var viewFlags = dbview.viewFlags;
let wasGrouped = viewFlags & nsMsgViewFlagsType.kGroupBySort;
dbview.viewFlags &= ~nsMsgViewFlagsType.kGroupBySort;
// if we were grouped, and not a saved search, just rebuild the view
if (wasGrouped && !(gMsgFolderSelected.flags &
- Components.interfaces.nsMsgFolderFlags.Virtual))
+ Ci.nsMsgFolderFlags.Virtual))
SwitchView("cmd_viewAllMsgs");
// Toggle if not already threaded.
else if ((viewFlags & nsMsgViewFlagsType.kThreadedDisplay) == 0)
MsgToggleThreaded();
}
function MsgGroupBySort()
{
@@ -282,40 +282,40 @@ function MsgGroupBySort()
|| sortType == nsMsgViewSortType.byAccount || sortType == nsMsgViewSortType.byFlagged
|| sortType == nsMsgViewSortType.byAttachments);
if (!sortTypeSupportsGrouping)
return; // we shouldn't be trying to group something we don't support grouping for...
viewFlags |= nsMsgViewFlagsType.kThreadedDisplay | nsMsgViewFlagsType.kGroupBySort;
if (gDBView &&
- gMsgFolderSelected.flags & Components.interfaces.nsMsgFolderFlags.Virtual)
+ gMsgFolderSelected.flags & Ci.nsMsgFolderFlags.Virtual)
{
gDBView.viewFlags = viewFlags;
UpdateSortIndicators(sortType, nsMsgViewSortOrder.ascending);
return;
}
// null this out, so we don't try sort.
if (gDBView) {
gDBView.close();
gDBView = null;
}
- gDBView = Components.classes["@mozilla.org/messenger/msgdbview;1?type=group"]
- .createInstance(Components.interfaces.nsIMsgDBView);
+ gDBView = Cc["@mozilla.org/messenger/msgdbview;1?type=group"]
+ .createInstance(Ci.nsIMsgDBView);
if (!gThreadPaneCommandUpdater)
gThreadPaneCommandUpdater = new nsMsgDBViewCommandUpdater();
gDBView.init(messenger, msgWindow, gThreadPaneCommandUpdater);
gDBView.open(msgFolder, sortType, sortOrder, viewFlags, count);
RerootThreadPane();
UpdateSortIndicators(sortType, nsMsgViewSortOrder.ascending);
Services.obs.notifyObservers(msgFolder, "MsgCreateDBView",
- Components.interfaces.nsMsgViewType.eShowAllThreads + ":" + viewFlags);
+ Ci.nsMsgViewType.eShowAllThreads + ":" + viewFlags);
}
function MsgSortUnthreaded()
{
// Toggle if not already unthreaded.
if ((GetDBView().viewFlags & nsMsgViewFlagsType.kThreadedDisplay) != 0)
MsgToggleThreaded();
}
@@ -427,17 +427,17 @@ function EnsureRowInThreadTreeIsVisible(
var tree = GetThreadTree();
tree.treeBoxObject.ensureRowIsVisible(index);
}
function RerootThreadPane()
{
SetNewsFolderColumns();
- var treeView = gDBView.QueryInterface(Components.interfaces.nsITreeView);
+ var treeView = gDBView.QueryInterface(Ci.nsITreeView);
if (treeView)
{
var tree = GetThreadTree();
tree.view = treeView;
}
}
function ThreadPaneOnLoad()
--- a/suite/mailnews/widgetglue.js
+++ b/suite/mailnews/widgetglue.js
@@ -155,17 +155,17 @@ function MsgFolderProperties()
let msgFolder = GetMsgFolderFromUri(GetSelectedFolderURI(), true);
// if a server is selected, view settings for that account
if (msgFolder.isServer) {
MsgAccountManager(null, msgFolder.server);
return;
}
- if (msgFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual)
+ if (msgFolder.flags & Ci.nsMsgFolderFlags.Virtual)
{
// virtual folders get their own property dialog that contains all of the
// search information related to the virtual folder.
MsgVirtualFolderProperties(true);
return;
}
var windowTitle = gMessengerBundle.getString("folderProperties");
--- a/suite/modules/PlacesUIUtils.jsm
+++ b/suite/modules/PlacesUIUtils.jsm
@@ -21,17 +21,17 @@ function IsLivemark(aItemId) {
let self = IsLivemark;
if (!("ids" in self)) {
const LIVEMARK_ANNO = PlacesUtils.LMANNO_FEEDURI;
let idsVec = PlacesUtils.annotations.getItemsWithAnnotation(LIVEMARK_ANNO);
self.ids = new Set(idsVec);
let obs = {
- QueryInterface: XPCOMUtils.generateQI(Components.interfaces.nsIAnnotationObserver),
+ QueryInterface: XPCOMUtils.generateQI(Ci.nsIAnnotationObserver),
onItemAnnotationSet(itemId, annoName) {
if (annoName == LIVEMARK_ANNO)
self.ids.add(itemId);
},
onItemAnnotationRemoved(itemId, annoName) {
// If annoName is set to an empty string, the item is gone.
@@ -62,28 +62,28 @@ var PlacesUIUtils = {
/**
* Makes a URI from a spec, and do fixup
* @param aSpec
* The string spec of the URI
* @returns A URI object for the spec.
*/
createFixedURI: function PUIU_createFixedURI(aSpec) {
- return URIFixup.createFixupURI(aSpec, Components.interfaces.nsIURIFixup.FIXUP_FLAG_NONE);
+ return URIFixup.createFixupURI(aSpec, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
},
/**
* Wraps a string in a nsISupportsString wrapper
* @param aString
* The string to wrap
* @returns A nsISupportsString object containing a string.
*/
_wrapString: function PUIU__wrapString(aString) {
- var s = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ var s = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
s.data = aString;
return s;
},
getFormattedString: function PUIU_getFormattedString(key, params) {
return bundle.formatStringFromName(key, params, params.length);
},
@@ -671,17 +671,17 @@ var PlacesUIUtils = {
let node = aNode;
// The view for a <menu> of which its associated menupopup is a places
// view, is the menupopup.
if (node.localName == "menu" && !node._placesNode &&
node.lastChild._placesView)
return node.lastChild._placesView;
- while (node instanceof Components.interfaces.nsIDOMElement) {
+ while (node instanceof Ci.nsIDOMElement) {
if (node._placesView)
return node._placesView;
if (node.localName == "tree" && node.getAttribute("type") == "places")
return node;
node = node.parentNode;
}
@@ -733,20 +733,20 @@ var PlacesUIUtils = {
*/
checkURLSecurity: function PUIU_checkURLSecurity(aURINode, aWindow) {
if (PlacesUtils.nodeIsBookmark(aURINode))
return true;
var uri = PlacesUtils._uri(aURINode.uri);
if (uri.schemeIs("javascript") || uri.schemeIs("data")) {
const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties";
- var brandShortName = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle(BRANDING_BUNDLE_URI)
- .GetStringFromName("brandShortName");
+ var brandShortName = Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle(BRANDING_BUNDLE_URI)
+ .GetStringFromName("brandShortName");
var errorStr = this.getString("load-js-data-url-error");
Services.prompt.alert(aWindow, brandShortName, errorStr);
return false;
}
return true;
},
@@ -879,20 +879,20 @@ var PlacesUIUtils = {
if (Services.prefs.getBoolPref(WARN_ON_OPEN_PREF)) {
if (numTabsToOpen >= Services.prefs.getIntPref("browser.tabs.maxOpenBeforeWarn")) {
// default to true: if it were false, we wouldn't get this far
var warnOnOpen = { value: true };
var messageKey = "tabs.openWarningMultipleBranded";
var openKey = "tabs.openButtonMultiple";
const BRANDING_BUNDLE_URI = "chrome://branding/locale/brand.properties";
- var brandShortName = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle(BRANDING_BUNDLE_URI)
- .GetStringFromName("brandShortName");
+ var brandShortName = Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle(BRANDING_BUNDLE_URI)
+ .GetStringFromName("brandShortName");
var buttonPressed = Services.prompt.confirmEx(
this._getCurrentActiveWin(),
this.getString("tabs.openWarningTitle"),
this.getFormattedString(messageKey, [numTabsToOpen, brandShortName]),
(Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0) +
(Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1),
this.getString(openKey), null, null,
@@ -1016,17 +1016,17 @@ var PlacesUIUtils = {
getBestTitle: function PUIU_getBestTitle(aNode) {
var title;
if (!aNode.title && PlacesUtils.nodeIsURI(aNode)) {
// if node title is empty, try to set the label using host and filename
// PlacesUtils._uri() will throw if aNode.uri is not a valid URI
try {
var uri = PlacesUtils._uri(aNode.uri);
var host = uri.host;
- var fileName = uri.QueryInterface(Components.interfaces.nsIURL).fileName;
+ var fileName = uri.QueryInterface(Ci.nsIURL).fileName;
// if fileName is empty, use path to distinguish labels
title = host + (fileName ?
(host ? "/" + this.ellipsis + "/" : "") + fileName :
uri.pathQueryRef);
}
catch (e) {
// Use (no title) for non-standard URIs (data:, javascript:, ...)
title = "";
@@ -1235,19 +1235,19 @@ var PlacesUIUtils = {
PlacesUIUtils.leftPaneQueries = { };
// Left Pane Root Folder.
leftPaneRoot = this.create_folder("PlacesRoot", bs.placesRoot, true);
// Tags Query.
this.create_query("Tags", leftPaneRoot,
"place:type=" +
- Components.interfaces.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY +
+ Ci.nsINavHistoryQueryOptions.RESULTS_AS_TAG_QUERY +
"&sort=" +
- Components.interfaces.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING);
+ Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING);
// All Bookmarks Folder.
allBookmarksId = this.create_folder("AllBookmarks", leftPaneRoot, false);
// All Bookmarks->Bookmarks Toolbar Query.
this.create_query("BookmarksToolbar", allBookmarksId,
"place:folder=TOOLBAR");
@@ -1310,29 +1310,29 @@ var PlacesUIUtils = {
};
XPCOMUtils.defineLazyServiceGetter(PlacesUIUtils, "xulStore",
"@mozilla.org/xul/xulstore;1",
"nsIXULStore");
XPCOMUtils.defineLazyGetter(PlacesUIUtils, "ellipsis", function() {
return Services.prefs.getComplexValue("intl.ellipsis",
- Components.interfaces.nsIPrefLocalizedString).data;
+ Ci.nsIPrefLocalizedString).data;
});
XPCOMUtils.defineLazyServiceGetter(this, "URIFixup",
"@mozilla.org/docshell/urifixup;1",
"nsIURIFixup");
XPCOMUtils.defineLazyGetter(this, "bundle", function() {
const PLACES_STRING_BUNDLE_URI =
"chrome://communicator/locale/places/places.properties";
- return Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService)
- .createBundle(PLACES_STRING_BUNDLE_URI);
+ return Cc["@mozilla.org/intl/stringbundle;1"]
+ .getService(Ci.nsIStringBundleService)
+ .createBundle(PLACES_STRING_BUNDLE_URI);
});
XPCOMUtils.defineLazyServiceGetter(this, "focusManager",
"@mozilla.org/focus-manager;1",
"nsIFocusManager");
/**
* This is a compatibility shim for old PUIU.ptm users.
@@ -1441,20 +1441,20 @@ XPCOMUtils.defineLazyGetter(PlacesUIUtil
* id of the item to edit.
* @param aDescription
* new description.
* @returns nsITransaction object.
*/
editItemDescription: function(aItemId, aDescription)
{
let annoObj = { name: PlacesUIUtils.DESCRIPTION_ANNO,
- type: Components.interfaces.nsIAnnotationService.TYPE_STRING,
+ type: Ci.nsIAnnotationService.TYPE_STRING,
flags: 0,
value: aDescription,
- expires: Components.interfaces.nsIAnnotationService.EXPIRE_NEVER };
+ expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
return new PlacesSetItemAnnotationTransaction(aItemId, annoObj);
},
////////////////////////////////////////////////////////////////////////////
//// nsITransactionManager forwarders.
beginBatch: function() {
PlacesUtils.transactionManager.beginBatch(null);
--- a/suite/modules/Sanitizer.jsm
+++ b/suite/modules/Sanitizer.jsm
@@ -106,19 +106,19 @@ var Sanitizer = {
!this._prefs.prefHasUserValue("didShutdownSanitize"))
this.readSettings();
else
this.clearSettings();
},
// clear plugin data
_clearPluginData: function(aFlagName) {
- const nsIPluginHost = Components.interfaces.nsIPluginHost;
- var ph = Components.classes["@mozilla.org/plugin/host;1"]
- .getService(nsIPluginHost);
+ const nsIPluginHost = Ci.nsIPluginHost;
+ var ph = Cc["@mozilla.org/plugin/host;1"]
+ .getService(nsIPluginHost);
if (!(aFlagName in nsIPluginHost))
return;
var flag = nsIPluginHost[aFlagName];
var tags = ph.getPluginTags();
for (var i = 0; i < tags.length; i++) {
try {
@@ -132,20 +132,20 @@ var Sanitizer = {
items: {
cache: {
clear: function() {
// use try/catch for everything but the last task so we clear as much as possible
try {
Services.cache2.clear();
} catch(ex) {}
- Components.classes["@mozilla.org/image/tools;1"]
- .getService(Components.interfaces.imgITools)
- .getImgCacheForDocument(null)
- .clearCache(false); // true=chrome, false=content
+ Cc["@mozilla.org/image/tools;1"]
+ .getService(Ci.imgITools)
+ .getImgCacheForDocument(null)
+ .clearCache(false); // true=chrome, false=content
},
canClear: true
},
offlineApps: {
clear: function() {
// use try/catch for everything but the last task so we clear as much as possible
@@ -156,18 +156,18 @@ var Sanitizer = {
} catch(ex) {}
},
canClear: true
},
cookies: {
clear: function() {
- var cookieMgr = Components.classes["@mozilla.org/cookiemanager;1"]
- .getService(Components.interfaces.nsICookieManager);
+ var cookieMgr = Cc["@mozilla.org/cookiemanager;1"]
+ .getService(Ci.nsICookieManager);
cookieMgr.removeAll();
Sanitizer._clearPluginData("FLAG_CLEAR_ALL");
// clear any network geolocation provider sessions
try {
Services.prefs.deleteBranch("geo.wifi.access_token.");
} catch (e) {}
@@ -181,18 +181,18 @@ var Sanitizer = {
ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
// use try/catch for everything but the last task so we clear as much as possible
try {
PlacesUtils.history.clear();
} catch(ex) {}
try {
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.notifyObservers(null, "browser:purge-session-history");
} catch(ex) {}
},
// bug 347231: Always allow clearing history due to dependencies on
// the browser:purge-session-history notification. (like error console)
canClear: true
},
@@ -200,32 +200,32 @@ var Sanitizer = {
urlbar: {
clear: function() {
// Clear last URL of the Open Web Location dialog
try {
Services.prefs.clearUserPref("general.open_location.last_url");
} catch(ex) {}
// Clear URLbar history (see also pref-history.js)
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("ProfD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("ProfD", Ci.nsIFile);
file.append("urlbarhistory.sqlite");
if (file.exists())
file.remove(false);
},
get canClear() {
if (!Services.prefs.prefIsLocked("general.open_location.last_url") &&
Services.prefs.prefHasUserValue("general.open_location.last_url"))
return true;
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("ProfD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("ProfD", Ci.nsIFile);
file.append("urlbarhistory.sqlite");
return file.exists();
}
},
formdata: {
clear: function() {
// Clear undo history of all search and find bars.
@@ -280,65 +280,65 @@ var Sanitizer = {
return false;
}
}
}
var count = 0;
var countDone = {
handleResult: aResult => count = aResult,
- handleError: aError => Components.utils.reportError(aError),
+ handleError: aError => Cu.reportError(aError),
handleCompletion(aReason) {
aCallback("formdata", !aReason && count, aArg);
}
};
FormHistory.count({}, countDone);
return false;
}
},
downloads: {
clear: function() {
- var dlMgr = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dlMgr = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
dlMgr.cleanUp();
},
get canClear() {
- var dlMgr = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ var dlMgr = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
return dlMgr.canCleanUp;
}
},
passwords: {
clear: function() {
- var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
- .getService(Components.interfaces.nsILoginManager);
+ var pwmgr = Cc["@mozilla.org/login-manager;1"]
+ .getService(Ci.nsILoginManager);
pwmgr.removeAllLogins();
},
get canClear() {
- var pwmgr = Components.classes["@mozilla.org/login-manager;1"]
- .getService(Components.interfaces.nsILoginManager);
+ var pwmgr = Cc["@mozilla.org/login-manager;1"]
+ .getService(Ci.nsILoginManager);
var count = pwmgr.countLogins("", "", ""); // count all logins
return (count > 0);
}
},
sessions: {
clear: function() {
// clear all auth tokens
- Components.classes["@mozilla.org/security/pk11tokendb;1"]
- .createInstance(Components.interfaces.nsIPK11TokenDB)
- .getInternalKeyToken()
- .checkPassword("");
+ Cc["@mozilla.org/security/pk11tokendb;1"]
+ .createInstance(Ci.nsIPK11TokenDB)
+ .getInternalKeyToken()
+ .checkPassword("");
// clear plain HTTP auth sessions
- var authMgr = Components.classes["@mozilla.org/network/http-auth-manager;1"]
- .getService(Components.interfaces.nsIHttpAuthManager);
+ var authMgr = Cc["@mozilla.org/network/http-auth-manager;1"]
+ .getService(Ci.nsIHttpAuthManager);
authMgr.clearAll();
},
canClear: true
}
}
};
--- a/suite/modules/WindowsPreviewPerTab.jsm
+++ b/suite/modules/WindowsPreviewPerTab.jsm
@@ -67,21 +67,21 @@ XPCOMUtils.defineLazyServiceGetter(this,
ChromeUtils.defineModuleGetter(this, "PageThumbs",
"resource://gre/modules/PageThumbs.jsm");
// nsIURI -> imgIContainer
function _imageFromURI(uri, privateMode, callback) {
let channel = NetUtil.newChannel({
uri: uri,
loadUsingSystemPrincipal: true,
- contentPolicyType: Components.interfaces.nsIContentPolicy.TYPE_INTERNAL_IMAGE
+ contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE
});
try {
- channel.QueryInterface(Components.interfaces.nsIPrivateBrowsingChannel);
+ channel.QueryInterface(Ci.nsIPrivateBrowsingChannel);
channel.setPrivate(privateMode);
} catch (e) {
// Ignore channels which do not support nsIPrivateBrowsingChannel.
}
NetUtil.asyncFetch(channel, function(inputStream, resultCode) {
if (!Components.isSuccessCode(resultCode))
return;
try {
@@ -135,18 +135,18 @@ function PreviewController(win, tab) {
XPCOMUtils.defineLazyGetter(this, "canvasPreview", function () {
let canvas = PageThumbs.createCanvas();
canvas.mozOpaque = true;
return canvas;
});
}
PreviewController.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsITaskbarPreviewController,
- Components.interfaces.nsIDOMEventListener]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsITaskbarPreviewController,
+ Ci.nsIDOMEventListener]),
destroy: function () {
this.tab.removeEventListener("TabAttrModified", this);
// Break cycles, otherwise we end up leaking the window with everything
// attached to it.
delete this.win;
delete this.preview;
@@ -173,17 +173,17 @@ PreviewController.prototype = {
// from nsIContentViewer due to conversion through appUnits.
// We do -not- want screenPixelsPerCSSPixel here, because that would -also-
// incorporate any scaling that is applied due to hi-dpi resolution options.
return this.tab.linkedBrowser.fullZoom;
},
get screenPixelsPerCSSPixel() {
let chromeWin = this.tab.ownerGlobal;
- let windowUtils = chromeWin.getInterface(Components.interfaces.nsIDOMWindowUtils);
+ let windowUtils = chromeWin.getInterface(Ci.nsIDOMWindowUtils);
return windowUtils.screenPixelsPerCSSPixel;
},
get browserDims() {
return this.tab.linkedBrowser.getBoundingClientRect();
},
cacheBrowserDims: function () {
@@ -321,17 +321,17 @@ PreviewController.prototype = {
case "TabAttrModified":
this.updateTitleAndTooltip();
break;
}
}
};
XPCOMUtils.defineLazyGetter(PreviewController.prototype, "canvasPreviewFlags",
- function () { let canvasInterface = Components.interfaces.nsIDOMCanvasRenderingContext2D;
+ function () { let canvasInterface = Ci.nsIDOMCanvasRenderingContext2D;
return canvasInterface.DRAWWINDOW_DRAW_VIEW
| canvasInterface.DRAWWINDOW_DRAW_CARET
| canvasInterface.DRAWWINDOW_ASYNC_DECODE_IMAGES
| canvasInterface.DRAWWINDOW_DO_NOT_FLUSH;
});
////////////////////////////////////////////////////////////////////////////////
//// TabWindow
@@ -415,19 +415,19 @@ TabWindow.prototype = {
AeroPeek.addPreview(controller.preview);
// updateTitleAndTooltip relies on having controller.preview which is lazily resolved.
// Now that we've updated this.previews, it will resolve successfully.
controller.updateTitleAndTooltip();
},
createTabPreview: function (controller) {
let docShell = this.win
- .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
- .getInterface(Components.interfaces.nsIWebNavigation)
- .QueryInterface(Components.interfaces.nsIDocShell);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell);
let preview = AeroPeek.taskbar.createTaskbarTabPreview(docShell, controller);
preview.visible = AeroPeek.enabled;
preview.active = this.tabbrowser.selectedTab == controller.tab;
this.onLinkIconAvailable(controller.tab.linkedBrowser,
controller.tab.getAttribute("image"));
return preview;
},
@@ -510,32 +510,32 @@ TabWindow.prototype = {
this.onResize();
break;
}
},
// Set or reset a timer that will invalidate visible thumbnails soon.
setInvalidationTimer: function () {
if (!this.invalidateTimer) {
- this.invalidateTimer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
+ this.invalidateTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
}
this.invalidateTimer.cancel();
// Delay 1 second before invalidating.
this.invalidateTimer.initWithCallback(() => {
// Invalidate every preview. Note the internal implementation of
// invalidate ignores thumbnails that aren't visible.
this.previews.forEach(function (aPreview) {
let controller = aPreview.controller.wrappedJSObject;
if (!controller.testCacheBrowserDims()) {
controller.cacheBrowserDims();
aPreview.invalidate();
}
});
- }, 1000, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ }, 1000, Ci.nsITimer.TYPE_ONE_SHOT);
},
onResize: function () {
// Specific to a window.
// Call invalidate on each tab thumbnail so that Windows will request an
// updated image. However don't do this repeatedly across multiple resize
// events triggered during window border drags.
@@ -563,18 +563,18 @@ TabWindow.prototype = {
onLocationChange: function (aBrowser) {
// I'm not sure we need this, onStateChange does a really good job
// of picking up page changes.
// this.invalidateTabPreview(aBrowser);
},
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
- if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP &&
- aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_IS_NETWORK) {
+ if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
+ aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK) {
this.invalidateTabPreview(aBrowser);
}
},
directRequestProtocols: new Set([
"file", "chrome", "resource", "about"
]),
@@ -646,18 +646,18 @@ this.AeroPeek = {
maxpreviews: 20,
// Length of time in seconds that previews are cached.
cacheLifespan: 20,
initialize: function () {
if (!(WINTASKBAR_CONTRACTID in Components.classes))
return;
- this.taskbar = Components.classes[WINTASKBAR_CONTRACTID]
- .getService(Components.interfaces.nsIWinTaskbar);
+ this.taskbar = Cc[WINTASKBAR_CONTRACTID]
+ .getService(Ci.nsIWinTaskbar);
this.available = this.taskbar.available;
if (!this.available)
return;
this.prefs.addObserver(TOGGLE_PREF_NAME, this, true);
this.enabled = this._prefenabled = this.prefs.getBoolPref(TOGGLE_PREF_NAME);
this.initialized = true;
},
@@ -778,17 +778,17 @@ this.AeroPeek = {
if (this.windows.length == 0)
this.destroy();
},
resetCacheTimer: function () {
this.cacheTimer.cancel();
this.cacheTimer.init(this, 1000 * this.cacheLifespan,
- Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+ Ci.nsITimer.TYPE_ONE_SHOT);
},
//// nsIObserver
observe: function (aSubject, aTopic, aData) {
if (aTopic == "nsPref:changed" && aData == TOGGLE_PREF_NAME) {
this._prefenabled = this.prefs.getBoolPref(TOGGLE_PREF_NAME);
}
@@ -823,33 +823,33 @@ this.AeroPeek = {
onVisit() {},
onTitleChanged() {},
onFrecencyChanged() {},
onManyFrecenciesChanged() {},
onDeleteURI() {},
onClearHistory() {},
onDeleteVisits() {},
onPageChanged(uri, changedConst, newValue) {
- if (this.enabled && changedConst == Components.interfaces.nsINavHistoryObserver.ATTRIBUTE_FAVICON) {
+ if (this.enabled && changedConst == Ci.nsINavHistoryObserver.ATTRIBUTE_FAVICON) {
for (let win of this.windows) {
for (let [tab, preview] of win.previews) {
if (tab.getAttribute("image") == newValue) {
win.onLinkIconAvailable(tab.linkedBrowser, newValue);
}
}
}
}
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupportsWeakReference,
- Components.interfaces.nsINavHistoryObserver,
- Components.interfaces.nsIObserver]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference,
+ Ci.nsINavHistoryObserver,
+ Ci.nsIObserver]),
};
XPCOMUtils.defineLazyGetter(AeroPeek, "cacheTimer", () =>
- Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer)
+ Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)
);
XPCOMUtils.defineLazyServiceGetter(AeroPeek, "prefs",
"@mozilla.org/preferences-service;1",
"nsIPrefBranch");
AeroPeek.initialize();
--- a/suite/modules/test/unit/test_browser_sanitizer.js
+++ b/suite/modules/test/unit/test_browser_sanitizer.js
@@ -2,94 +2,94 @@ ChromeUtils.import("resource:///modules/
ChromeUtils.defineModuleGetter(this, "FormHistory",
"resource://gre/modules/FormHistory.jsm");
var sanTests = {
cache: {
desc: "Cache",
async setup() {
var entry = null;
- this.cs = Services.cache.createSession("SanitizerTest", Components.interfaces.nsICache.STORE_ANYWHERE, true);
- entry = await promiseOpenCacheEntry("http://santizer.test", Components.interfaces.nsICache.ACCESS_READ_WRITE, this.cs);
+ this.cs = Services.cache.createSession("SanitizerTest", Ci.nsICache.STORE_ANYWHERE, true);
+ entry = await promiseOpenCacheEntry("http://santizer.test", Ci.nsICache.ACCESS_READ_WRITE, this.cs);
entry.setMetaDataElement("Foo", "Bar");
entry.markValid();
entry.close();
},
async check(aShouldBeCleared) {
let entry = null;
- entry = await promiseOpenCacheEntry("http://santizer.test", Components.interfaces.nsICache.ACCESS_READ, this.cs);
+ entry = await promiseOpenCacheEntry("http://santizer.test", Ci.nsICache.ACCESS_READ, this.cs);
if (entry) {
entry.close();
}
Assert.equal(!entry, aShouldBeCleared);
}
},
offlineApps: {
desc: "Offline app cache",
async setup() {
//XXX test offline DOMStorage
var entry = null;
- this.cs = Services.cache.createSession("SanitizerTest", Components.interfaces.nsICache.STORE_OFFLINE, true);
- entry = await promiseOpenCacheEntry("http://santizer.test", Components.interfaces.nsICache.ACCESS_READ_WRITE, this.cs);
+ this.cs = Services.cache.createSession("SanitizerTest", Ci.nsICache.STORE_OFFLINE, true);
+ entry = await promiseOpenCacheEntry("http://santizer.test", Ci.nsICache.ACCESS_READ_WRITE, this.cs);
entry.setMetaDataElement("Foo", "Bar");
entry.markValid();
entry.close();
},
async check(aShouldBeCleared) {
var entry = null;
- entry = await promiseOpenCacheEntry("http://santizer.test", Components.interfaces.nsICache.ACCESS_READ, this.cs);
+ entry = await promiseOpenCacheEntry("http://santizer.test", Ci.nsICache.ACCESS_READ, this.cs);
if (entry) {
entry.close();
}
Assert.equal(!entry, aShouldBeCleared);
}
},
cookies: {
desc: "Cookie",
setup: function() {
Services.prefs.setIntPref("network.cookie.cookieBehavior", 0);
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
this.uri = ios.newURI("http://sanitizer.test/");
- this.cs = Components.classes["@mozilla.org/cookieService;1"]
- .getService(Components.interfaces.nsICookieService);
+ this.cs = Cc["@mozilla.org/cookieService;1"]
+ .getService(Ci.nsICookieService);
this.cs.setCookieString(this.uri, null, "Sanitizer!", null);
},
check: function(aShouldBeCleared) {
if (aShouldBeCleared)
Assert.notEqual(this.cs.getCookieString(this.uri, null), "Sanitizer!");
else
Assert.equal(this.cs.getCookieString(this.uri, null), "Sanitizer!");
}
},
history: {
desc: "History",
async setup() {
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
var uri = ios.newURI("http://sanitizer.test/");
await promiseAddVisits({
uri: uri,
title: "Sanitizer!"
});
},
check: function(aShouldBeCleared) {
var rv = false;
- var history = Components.classes["@mozilla.org/browser/nav-history-service;1"]
- .getService(Components.interfaces.nsINavHistoryService);
+ var history = Cc["@mozilla.org/browser/nav-history-service;1"]
+ .getService(Ci.nsINavHistoryService);
var options = history.getNewQueryOptions();
var query = history.getNewQuery();
query.searchTerms = "Sanitizer!";
var results = history.executeQuery(query, options).root;
results.containerOpen = true;
for (var i = 0; i < results.childCount; i++) {
if (results.getChild(i).uri == "http://sanitizer.test/") {
rv = true;
@@ -103,24 +103,24 @@ var sanTests = {
Assert.equal(rv, !aShouldBeCleared);
}
},
urlbar: {
desc: "Location bar history",
setup: function() {
// Create urlbarhistory file first otherwise tests will fail.
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("ProfD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("ProfD", Ci.nsIFile);
file.append("urlbarhistory.sqlite");
if (!file.exists()) {
- var connection = Components.classes["@mozilla.org/storage/service;1"]
- .getService(Components.interfaces.mozIStorageService)
- .openDatabase(file);
+ var connection = Cc["@mozilla.org/storage/service;1"]
+ .getService(Ci.mozIStorageService)
+ .openDatabase(file);
connection.createTable("urlbarhistory", "url TEXT");
connection.executeSimpleSQL(
"INSERT INTO urlbarhistory (url) VALUES ('Sanitizer')");
connection.close();
}
// Open location dialog.
Services.prefs.setStringPref("general.open_location.last_url", "Sanitizer!");
@@ -129,24 +129,24 @@ var sanTests = {
check: function(aShouldBeCleared) {
let locData;
try {
locData = Services.prefs.getStringPref("general.open_location.last_url");
} catch(ex) {}
Assert.equal(locData == "Sanitizer!", !aShouldBeCleared);
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("ProfD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("ProfD", Ci.nsIFile);
file.append("urlbarhistory.sqlite");
- var connection = Components.classes["@mozilla.org/storage/service;1"]
- .getService(Components.interfaces.mozIStorageService)
- .openDatabase(file);
+ var connection = Cc["@mozilla.org/storage/service;1"]
+ .getService(Ci.mozIStorageService)
+ .openDatabase(file);
var urlbar = connection.tableExists("urlbarhistory");
if (urlbar) {
var handle = connection.createStatement(
"SELECT url FROM urlbarhistory");
if (handle.executeStep())
urlbar = (handle.getString(0) == "Sanitizer");
handle.reset();
handle.finalize();
@@ -200,32 +200,32 @@ var sanTests = {
let exists = await formNameExists("Sanitizer");
Assert.equal(exists, !aShouldBeCleared);
}
},
downloads: {
desc: "Download",
setup: function() {
- var ios = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
+ var ios = Cc["@mozilla.org/network/io-service;1"]
+ .getService(Ci.nsIIOService);
var uri = ios.newURI("http://sanitizer.test/");
- var file = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties)
- .get("TmpD", Components.interfaces.nsIFile);
+ var file = Cc["@mozilla.org/file/directory_service;1"]
+ .getService(Ci.nsIProperties)
+ .get("TmpD", Ci.nsIFile);
file.append("sanitizer.file");
- file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, parseInt("0666", 8));
+ file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, parseInt("0666", 8));
var dest = ios.newFileURI(file);
- this.dm = Components.classes["@mozilla.org/download-manager;1"]
- .getService(Components.interfaces.nsIDownloadManager);
+ this.dm = Cc["@mozilla.org/download-manager;1"]
+ .getService(Ci.nsIDownloadManager);
- const nsIWBP = Components.interfaces.nsIWebBrowserPersist;
- var persist = Components.classes["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
- .createInstance(nsIWBP);
+ const nsIWBP = Ci.nsIWebBrowserPersist;
+ var persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"]
+ .createInstance(nsIWBP);
persist.persistFlags = nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES |
nsIWBP.PERSIST_FLAGS_BYPASS_CACHE |
nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
this.dl = this.dm.addDownload(this.dm.DOWNLOAD_CANCELED, uri, dest,
"Sanitizer!", null,
Math.round(Date.now() * 1000), null,
persist, false);
@@ -245,20 +245,20 @@ var sanTests = {
else
Assert.equal(dl.displayName, "Sanitizer!");
}
},
passwords: {
desc: "Login manager",
setup: function() {
- this.pm = Components.classes["@mozilla.org/login-manager;1"]
- .getService(Components.interfaces.nsILoginManager);
+ this.pm = Cc["@mozilla.org/login-manager;1"]
+ .getService(Ci.nsILoginManager);
var info = Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
- Components.interfaces.nsILoginInfo, "init");
+ Ci.nsILoginInfo, "init");
var login = new info("http://sanitizer.test", null, "Rick Astley Fan Club",
"dolske", "iliketurtles1", "", "");
this.pm.addLogin(login);
},
check: function(aShouldBeCleared) {
let rv = false;
let logins = this.pm.findLogins({}, "http://sanitizer.test", null, "Rick Astley Fan Club");
@@ -271,18 +271,18 @@ var sanTests = {
Assert.equal(rv, !aShouldBeCleared);
}
},
sessions: {
desc: "HTTP auth session",
setup: function() {
- this.authMgr = Components.classes["@mozilla.org/network/http-auth-manager;1"]
- .getService(Components.interfaces.nsIHttpAuthManager);
+ this.authMgr = Cc["@mozilla.org/network/http-auth-manager;1"]
+ .getService(Ci.nsIHttpAuthManager);
this.authMgr.setAuthIdentity("http", "sanitizer.test", 80, "basic", "Sanitizer",
"", "Foo", "fooo", "foo12");
},
check: function(aShouldBeCleared) {
var domain = {};
var user = {};
--- a/suite/profile/migration.js
+++ b/suite/profile/migration.js
@@ -1,34 +1,34 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
-const nsISuiteProfileMigrator = Components.interfaces.nsISuiteProfileMigrator;
-const nsIProfileStartup = Components.interfaces.nsIProfileStartup;
-const nsISupportsString = Components.interfaces.nsISupportsString;
+const nsISuiteProfileMigrator = Ci.nsISuiteProfileMigrator;
+const nsIProfileStartup = Ci.nsIProfileStartup;
+const nsISupportsString = Ci.nsISupportsString;
const NS_PROFILE_MIGRATOR_CONTRACTID = "@mozilla.org/profile/migrator;1?app=suite&type=";
var MigrationWizard = {
_source: "", // Source Profile Migrator ContractID suffix
_itemsFlags: nsISuiteProfileMigrator.ALL, // Selected Import Data Sources
_selectedProfile: null, // Selected Profile name to import from
_wiz: null, // Shortcut to the wizard
_migrator: null, // The actual profile migrator.
_autoMigrate: null, // Whether or not we are actually migrating.
_singleItem: false, // Are we choosing just to import a single
// item into the current profile?
_newHomePage: null, // Are we setting a new home page - what to?
init: function() {
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.addObserver(this, "Migration:Started");
os.addObserver(this, "Migration:ItemBeforeMigrate");
os.addObserver(this, "Migration:ItemAfterMigrate");
os.addObserver(this, "Migration:Ended");
os.addObserver(this, "Migration:Progress");
this._wiz = document.documentElement;
this._wiz.canRewind = false;
@@ -52,18 +52,18 @@ var MigrationWizard = {
document.getElementById("nothing").hidden = false;
}
}
this.onImportSourcePageShow();
},
uninit: function() {
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
+ var os = Cc["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService);
os.removeObserver(this, "Migration:Started");
os.removeObserver(this, "Migration:ItemBeforeMigrate");
os.removeObserver(this, "Migration:ItemAfterMigrate");
os.removeObserver(this, "Migration:Ended");
os.removeObserver(this, "Migration:Progress", false);
},
// 1 - Import Source
@@ -72,18 +72,18 @@ var MigrationWizard = {
var group = document.getElementById("importSourceGroup");
var firstSelectable = null;
for (var i = 0; i < group.childNodes.length; ++i) {
var suffix = group.childNodes[i].id;
if (suffix != "nothing" && suffix != "fromFile") {
var contractID = NS_PROFILE_MIGRATOR_CONTRACTID + suffix;
var migrator = null;
if (contractID in Components.classes) {
- migrator = Components.classes[contractID]
- .createInstance(nsISuiteProfileMigrator);
+ migrator = Cc[contractID]
+ .createInstance(nsISuiteProfileMigrator);
} else {
dump("*** invalid contractID =" + contractID + "\n");
// This is an invalid contract id, therefore hide this element
// and allow things to continue - that way we should be able to
// copy with anything happening.
group.childNodes[i].hidden = true;
break;
}
@@ -126,18 +126,18 @@ var MigrationWizard = {
// Don't let the wizard migrate to the next page event though we've
// called cancel - cancel may not get processed first.
return false;
}
if (!this._migrator || newSource != this._source) {
// Create the migrator for the selected source.
var contractID = NS_PROFILE_MIGRATOR_CONTRACTID + newSource;
- this._migrator = Components.classes[contractID]
- .createInstance(nsISuiteProfileMigrator);
+ this._migrator = Cc[contractID]
+ .createInstance(nsISuiteProfileMigrator);
this._selectedProfile = null;
}
this._source = newSource;
// check for more than one source profile
if (this._migrator.sourceHasMultipleProfiles)
this._wiz.currentPage.next = "selectProfile";
--- a/suite/profile/migration/src/SuiteProfileMigrator.js
+++ b/suite/profile/migration/src/SuiteProfileMigrator.js
@@ -14,41 +14,41 @@ function ProfileMigrator() {
ProfileMigrator.prototype = {
migrate: function PM_migrate(aStartup) {
// By opening the wizard with a supplied migrator, it will automatically
// migrate from it.
let [key, migrator] = this._getDefaultMigrator();
if (!key)
return;
- let params = Components.classes["@mozilla.org/array;1"]
- .createInstance(Components.interfaces.nsIMutableArray);
+ let params = Cc["@mozilla.org/array;1"]
+ .createInstance(Ci.nsIMutableArray);
params.appendElement(this._toString(key));
params.appendElement(migrator);
params.appendElement(aStartup);
Services.ww.openWindow(null,
"chrome://communicator/content/migration/migration.xul",
"_blank",
"chrome,dialog,modal,centerscreen,titlebar",
params);
},
_toString: function PM__toString(aStr) {
- let str = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
+ let str = Cc["@mozilla.org/supports-string;1"]
+ .createInstance(Ci.nsISupportsString);
str.data = aStr;
return str;
},
_getMigratorIfSourceExists: function PM__getMigratorIfSourceExists(aKey) {
let cid = "@mozilla.org/profile/migrator;1?app=suite&type=" + aKey;
- let migrator = Components.classes[cid]
- .createInstance(Components.interfaces
- .nsISuiteProfileMigrator);
+ let migrator = Cc[cid]
+ .createInstance(Ci
+ .nsISuiteProfileMigrator);
if (migrator.sourceExists)
return migrator;
return null;
},
// We don't yet support checking for the default browser on all platforms,
// needless to say we don't have migrators for all browsers. Thus, for each
// platform, there's a fallback list of migrators used in these cases.
@@ -57,18 +57,18 @@ ProfileMigrator.prototype = {
_getDefaultMigrator: function PM__getDefaultMigrator() {
let migratorsOrdered = Array.from(this._PLATFORM_FALLBACK_LIST);
#if 0
let defaultBrowser = "";
#ifdef XP_WIN
try {
const REG_KEY = "SOFTWARE\\Classes\\HTTP\\shell\\open\\command";
- let regKey = Components.classes["@mozilla.org/windows-registry-key;1"]
- .createInstance(Components.interfaces.nsIWindowsRegKey);
+ let regKey = Cc["@mozilla.org/windows-registry-key;1"]
+ .createInstance(Ci.nsIWindowsRegKey);
regKey.open(regKey.ROOT_KEY_LOCAL_MACHINE, REG_KEY,
regKey.ACCESS_READ);
let value = regKey.readStringValue("").toLowerCase();
let pathMatches = value.match(/^"?(.+?\.exe)"?/);
if (!pathMatches) {
throw new Error("Could not extract path from " +
REG_KEY + "(" + value + ")");
}
@@ -91,28 +91,28 @@ ProfileMigrator.prototype = {
// VarFileInfo
// Translation <TranslationID>
//
// By Querying the VERSIONINFO section for its Tranlations, we can find
// out where the InternalName lives (A file can have more than one
// translation of its VERSIONINFO segment, but we just assume the first
// one).
let file = FileUtils.File(pathMatches[1])
- .QueryInterface(Components.interfaces.nsILocalFileWin);
+ .QueryInterface(Ci.nsILocalFileWin);
switch (file.getVersionInfoField("InternalName").toLowerCase()) {
case "iexplore":
defaultBrowser = "ie";
break;
case "chrome":
defaultBrowser = "chrome";
break;
}
}
catch (ex) {
- Components.utils.reportError("Could not retrieve default browser: " + ex);
+ Cu.reportError("Could not retrieve default browser: " + ex);
}
#endif
// If we found the default browser and we have support for that browser,
// make sure to check it before any other browser, by moving it to the head
// of the array.
if (defaultBrowser)
migratorsOrdered.sort((a, b) => b == defaultBrowser ? 1 : 0);
@@ -121,15 +121,15 @@ ProfileMigrator.prototype = {
let migrator = this._getMigratorIfSourceExists(key);
if (migrator)
return [key, migrator];
}
return ["", null];
},
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIProfileMigrator]),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIProfileMigrator]),
classDescription: "Profile Migrator",
contractID: "@mozilla.org/toolkit/profile-migrator;1",
classID: Components.ID("{d5148b7c-ba4e-4f7a-a80b-1ae48b90b910}"),
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([ProfileMigrator]);
--- a/suite/security/prefs/pref-masterpass.js
+++ b/suite/security/prefs/pref-masterpass.js
@@ -2,30 +2,30 @@
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gInternalToken;
function Startup() {
- var tokendb = Components.classes["@mozilla.org/security/pk11tokendb;1"]
- .getService(Components.interfaces.nsIPK11TokenDB);
+ var tokendb = Cc["@mozilla.org/security/pk11tokendb;1"]
+ .getService(Ci.nsIPK11TokenDB);
gInternalToken = tokendb.getInternalKeyToken();
}
function ChangePW()
{
- var p = Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
- .createInstance(Components.interfaces.nsIDialogParamBlock);
+ var p = Cc["@mozilla.org/embedcomp/dialogparam;1"]
+ .createInstance(Ci.nsIDialogParamBlock);
p.SetString(1, "");
window.openDialog("chrome://pippki/content/changepassword.xul", "",
"chrome,centerscreen,modal", p);
}
function ResetPW()
{
- var p = Components.classes["@mozilla.org/embedcomp/dialogparam;1"]
- .createInstance(Components.interfaces.nsIDialogParamBlock);
+ var p = Cc["@mozilla.org/embedcomp/dialogparam;1"]
+ .createInstance(Ci.nsIDialogParamBlock);
p.SetString(1, gInternalToken.tokenName);
window.openDialog("chrome://pippki/content/resetpassword.xul", "",
"chrome,centerscreen,modal", p);
}
--- a/suite/shell/src/nsSetDefault.js
+++ b/suite/shell/src/nsSetDefault.js
@@ -5,43 +5,43 @@
/*
* This component handles the startup command line arguments of the form:
* -setDefaultBrowser
* -setDefaultMail
* -setDefaultNews
* -setDefaultFeed
*/
-const nsIShellService = Components.interfaces.nsIShellService;
-const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler;
+const nsIShellService = Ci.nsIShellService;
+const nsICommandLineHandler = Ci.nsICommandLineHandler;
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
function nsSetDefault() {
}
nsSetDefault.prototype = {
handle: function nsSetDefault_handle(aCmdline) {
if (aCmdline.handleFlag("setDefaultBrowser", false)) {
- var shell = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ var shell = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
shell.setDefaultClient(true, true, nsIShellService.BROWSER);
}
else if (aCmdline.handleFlag("setDefaultMail", false)) {
- var shell = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ var shell = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
shell.setDefaultClient(true, true, nsIShellService.MAIL);
}
else if (aCmdline.handleFlag("setDefaultNews", false)) {
- var shell = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ var shell = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
shell.setDefaultClient(true, true, nsIShellService.NEWS);
}
else if (aCmdline.handleFlag("setDefaultFeed", false)) {
- var shell = Components.classes["@mozilla.org/suite/shell-service;1"]
- .getService(nsIShellService);
+ var shell = Cc["@mozilla.org/suite/shell-service;1"]
+ .getService(nsIShellService);
shell.setDefaultClient(true, true, nsIShellService.RSS);
}
},
helpInfo: " -setDefaultBrowser Set this app as the default browser client.\n" +
" -setDefaultMail Set this app as the default mail client.\n" +
" -setDefaultNews Set this app as the default newsreader.\n" +
" -setDefaultFeed Set this app as the default feedreader.\n",